Struct zbus::MatchRuleBuilder

source ·
pub struct MatchRuleBuilder<'m>(/* private fields */);
Expand description

Builder for MatchRule.

This is created by MatchRule::builder.

Implementations§

source§

impl<'m> MatchRuleBuilder<'m>

source

pub fn build(self) -> MatchRule<'m>

Build the MatchRule.

source

pub fn sender<B>(self, sender: B) -> Result<Self>
where B: TryInto<BusName<'m>>, B::Error: Into<Error>,

Set the sender.

source

pub fn msg_type(self, msg_type: MessageType) -> Self

Set the message type.

source

pub fn interface<I>(self, interface: I) -> Result<Self>
where I: TryInto<InterfaceName<'m>>, I::Error: Into<Error>,

Set the interface.

source

pub fn member<M>(self, member: M) -> Result<Self>
where M: TryInto<MemberName<'m>>, M::Error: Into<Error>,

Set the member.

source

pub fn path<P>(self, path: P) -> Result<Self>
where P: TryInto<ObjectPath<'m>>, P::Error: Into<Error>,

Set the path.

Note: Since both a path and a path namespace are not allowed to appear in a match rule at the same time, this overrides any path namespace previously set.

source

pub fn path_namespace<P>(self, path_namespace: P) -> Result<Self>
where P: TryInto<ObjectPath<'m>>, P::Error: Into<Error>,

Set the path namespace.

Note: Since both a path and a path namespace are not allowed to appear in a match rule at the same time, this overrides any path previously set.

source

pub fn destination<B>(self, destination: B) -> Result<Self>
where B: TryInto<UniqueName<'m>>, B::Error: Into<Error>,

Set the destination.

source

pub fn add_arg<S>(self, arg: S) -> Result<Self>
where S: Into<Str<'m>>,

Append an arguments.

Use this in instead of MatchRuleBuilder::arg if you want to sequentially add args.

§Errors

Error::InvalidMatchRule on attempt to add the 65th argument.

source

pub fn arg<S>(self, idx: u8, arg: S) -> Result<Self>
where S: Into<Str<'m>>,

Add an argument of a specified index.

§Errors

Error::InvalidMatchRule if idx is greater than 64.

source

pub fn add_arg_path<P>(self, arg_path: P) -> Result<Self>
where P: TryInto<ObjectPath<'m>>, P::Error: Into<Error>,

Append a path argument.

Use this in instead of MatchRuleBuilder::arg_path if you want to sequentially add args.

§Errors

Error::InvalidMatchRule on attempt to add the 65th path argument.

source

pub fn arg_path<P>(self, idx: u8, arg_path: P) -> Result<Self>
where P: TryInto<ObjectPath<'m>>, P::Error: Into<Error>,

Add a path argument of a specified index.

§Errors

Error::InvalidMatchRule if idx is greater than 64.

source

pub fn arg0namespace<I>(self, namespace: I) -> Result<Self>
where I: TryInto<InterfaceName<'m>>, I::Error: Into<Error>,

👎Deprecated: use arg0ns instead

Set 0th argument’s namespace.

This function is deprecated because the choice of InterfaceName was too restrictive.

source

pub fn arg0ns<S>(self, namespace: S) -> Result<Self>
where S: Into<Str<'m>>,

Set 0th argument’s namespace.

The namespace be a valid bus name or a valid element of a bus name. For more information, see the spec.

§Examples
// Valid namespaces
MatchRule::builder().arg0ns("org.mpris.MediaPlayer2").unwrap();
MatchRule::builder().arg0ns("org").unwrap();
MatchRule::builder().arg0ns(":org").unwrap();
MatchRule::builder().arg0ns(":1org").unwrap();

// Invalid namespaces
MatchRule::builder().arg0ns("org.").unwrap_err();
MatchRule::builder().arg0ns(".org").unwrap_err();
MatchRule::builder().arg0ns("1org").unwrap_err();
MatchRule::builder().arg0ns(".").unwrap_err();
MatchRule::builder().arg0ns("org..freedesktop").unwrap_err();

Trait Implementations§

source§

impl<'m> Debug for MatchRuleBuilder<'m>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'m> Freeze for MatchRuleBuilder<'m>

§

impl<'m> RefUnwindSafe for MatchRuleBuilder<'m>

§

impl<'m> Send for MatchRuleBuilder<'m>

§

impl<'m> Sync for MatchRuleBuilder<'m>

§

impl<'m> Unpin for MatchRuleBuilder<'m>

§

impl<'m> UnwindSafe for MatchRuleBuilder<'m>

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<T> Same for T

source§

type Output = T

Should always be Self
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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more