IfaceBuilder

Struct IfaceBuilder 

Source
pub struct IfaceBuilder<T: Send + 'static>(/* private fields */);
Expand description

Struct used to build an interface.

You get an instance of this struct in the call to Crossroads::register.

Register new methods, properties and signals using the corresponding functions on this struct. You might find several similar functions, e g method, method_with_cr, method_with_cr_async and method_with_cr_custom. Methods that have “with_cr” will allow you to access the full mutable Crossroads instance, but beware - trying to recursively handle methods from within a method handler is not allowed and may cause panics.

Methods that have “_async” will allow you to defer the result of your method. During await points, other tasks with method calls can run as separate tasks. Remember to call Crossroads::set_async_support when using async methods.

Implementations§

Source§

impl<T: Send + 'static> IfaceBuilder<T>

Source

pub fn property<A: Arg, N: Into<String>>( &mut self, name: N, ) -> PropBuilder<'_, T, A>

Source

pub fn method<IA, OA, N, CB>( &mut self, name: N, input_args: IA::strs, output_args: OA::strs, cb: CB, ) -> &mut MethodDesc
where IA: ArgAll + ReadAll, OA: ArgAll + AppendAll, N: Into<Member<'static>>, CB: FnMut(&mut Context, &mut T, IA) -> Result<OA, MethodErr> + Send + 'static,

Source

pub fn method_with_cr<IA, OA, N, CB>( &mut self, name: N, input_args: IA::strs, output_args: OA::strs, cb: CB, ) -> &mut MethodDesc
where IA: ArgAll + ReadAll, OA: ArgAll + AppendAll, N: Into<Member<'static>>, CB: FnMut(&mut Context, &mut Crossroads, IA) -> Result<OA, MethodErr> + Send + 'static,

Source

pub fn method_with_cr_custom<IA, OA, N, CB>( &mut self, name: N, input_args: IA::strs, output_args: OA::strs, cb: CB, ) -> &mut MethodDesc
where IA: ArgAll + ReadAll, OA: ArgAll + AppendAll, N: Into<Member<'static>>, CB: FnMut(Context, &mut Crossroads, IA) -> Option<Context> + Send + 'static,

Source

pub fn method_with_cr_async<IA, OA, N, R, CB>( &mut self, name: N, input_args: IA::strs, output_args: OA::strs, cb: CB, ) -> &mut MethodDesc
where IA: ArgAll + ReadAll, OA: ArgAll + AppendAll, N: Into<Member<'static>>, CB: FnMut(Context, &mut Crossroads, IA) -> R + Send + 'static, R: Future<Output = PhantomData<OA>> + Send + 'static,

Source

pub fn signal<A, N>(&mut self, name: N, args: A::strs) -> SignalBuilder<'_, A>
where A: ArgAll, N: Into<Member<'static>>,

Source

pub fn annotate<N: Into<String>, V: Into<String>>( &mut self, name: N, value: V, ) -> &mut Self

Source

pub fn deprecated(&mut self) -> &mut Self

Trait Implementations§

Source§

impl<T: Debug + Send + 'static> Debug for IfaceBuilder<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for IfaceBuilder<T>

§

impl<T> !RefUnwindSafe for IfaceBuilder<T>

§

impl<T> Send for IfaceBuilder<T>
where T: Sync,

§

impl<T> !Sync for IfaceBuilder<T>

§

impl<T> Unpin for IfaceBuilder<T>

§

impl<T> !UnwindSafe for IfaceBuilder<T>

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, 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, 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.