Struct CoreRc

Source
pub struct CoreRc { /* private fields */ }

Implementations§

Source§

impl CoreRc

Source

pub fn from_raw(ptr: NonNull<pw_core>, context: ContextRc) -> Self

Source

pub fn downgrade(&self) -> CoreWeak

Source

pub fn get_registry_rc(&self) -> Result<RegistryRc, Error>

Methods from Deref<Target = Core>§

Source

pub fn as_raw(&self) -> &pw_core

Source

pub fn as_raw_ptr(&self) -> *mut pw_core

Source

pub fn add_listener_local(&self) -> ListenerLocalBuilder<'_>

Source

pub fn get_registry(&self) -> Result<RegistryBox<'_>, Error>

Source

pub fn sync(&self, seq: i32) -> Result<AsyncSeq, Error>

Source

pub fn create_object<P: ProxyT>( &self, factory_name: &str, properties: &impl AsRef<DictRef>, ) -> Result<P, Error>

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.

Source

pub fn create_object_cstr<P: ProxyT>( &self, factory_name: &CStr, properties: &impl AsRef<DictRef>, ) -> Result<P, Error>

Source

pub fn destroy_object<P: ProxyT>(&self, proxy: P) -> Result<AsyncSeq, Error>

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

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

Trait Implementations§

Source§

impl AsRef<Core> for CoreRc

Source§

fn as_ref(&self) -> &Core

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for CoreRc

Source§

fn clone(&self) -> CoreRc

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CoreRc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for CoreRc

Source§

type Target = Core

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl Freeze for CoreRc

§

impl !RefUnwindSafe for CoreRc

§

impl !Send for CoreRc

§

impl !Sync for CoreRc

§

impl Unpin for CoreRc

§

impl !UnwindSafe for CoreRc

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.