Struct pipewire::Core[][src]

pub struct Core { /* fields omitted */ }

Methods from Deref<Target = CoreInner>

Create a new object on the PipeWire server from a factory.

You will need specify what type you are expecting to be constructed by either using type inference or the turbofish syntax.

Parameters
  • factory_name the name of the factory to use
  • properties extra properties that the new object will have
Panics

If factory_name contains a null byte.

Returns

One of:

  • Ok(P) on success, where P is the newly created object
  • Err(Error::CreationFailed) if the object could not be created
  • Err(Error::WrongProxyType) if the created type does not match the type P that the user is trying to create
Examples

Creating a new link:

use pipewire as pw;

pw::init();

let mainloop = pw::MainLoop::new().expect("Failed to create Pipewire Mainloop");
let context = pw::Context::new(&mainloop).expect("Failed to create Pipewire Context");
let core = context
    .connect(None)
    .expect("Failed to connect to Pipewire Core");

// This call uses turbofish syntax to specify that we want a link.
let link = core.create_object::<pw::link::Link, _>(
    // The actual name for a link factory might be different for your system,
    // you should probably obtain a factory from the registry.
    "link-factory",
    &pw::properties! {
        "link.output.port" => "1",
        "link.input.port" => "2",
        "link.output.node" => "3",
        "link.input.node" => "4"
    },
)
.expect("Failed to create object");

See pipewire/examples/create-delete-remote-objects.rs in the crates repository for a more detailed example.

Destroy the object on the remote server represented by the provided proxy.

The proxy will be destroyed alongside the server side ressource, as it is no longer needed.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.