Skip to main content

Operation

Struct Operation 

Source
pub struct Operation<Handler, Params = Positional> { /* private fields */ }
Expand description

Carries a typed operation declaration as first-order data.

Implementations§

Source§

impl<Handler, Params> Operation<Handler, Params>

Source

pub fn declare(self, name: &'static str) -> Method<Handler, Params>

Declares this operation under one method name, with no program around it.

A program that states many methods composes their registrations rather than their types, so it needs each method on its own. JsonRpcProgram::method states the same thing inside a composition, and is what an author writes.

Source§

impl<Handler> Operation<Handler, Positional>

Source

pub fn positional(self) -> Self

Selects positional parameter decoding for this operation declaration.

Positional decoding is already the default, so this modifier is useful when a declaration benefits from making the wire shape explicit.

Source

pub fn named(self) -> Operation<Handler, NamedParams>

Selects named parameter decoding using the defunctionalized operation’s source argument names.

Source

pub fn fallible(self) -> Operation<Handler, FalliblePositional>

Converts the operation’s error into a JSON-RPC protocol error.

Source§

impl<Handler> Operation<Handler, NamedParams>

Source

pub fn fallible(self) -> Operation<Handler, FallibleNamed>

Converts the operation’s error into a JSON-RPC protocol error.

Source§

impl<Handler> Operation<Handler, FalliblePositional>

Source

pub fn named(self) -> Operation<Handler, FallibleNamed>

Selects named parameter decoding, keeping the failure mode.

Trait Implementations§

Source§

impl<Handler: Debug, Params: Debug> Debug for Operation<Handler, Params>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Handler, Params> Freeze for Operation<Handler, Params>
where Handler: Freeze, PhantomData<fn(Params)>: Freeze,

§

impl<Handler, Params> RefUnwindSafe for Operation<Handler, Params>
where Handler: RefUnwindSafe, PhantomData<fn(Params)>: RefUnwindSafe,

§

impl<Handler, Params> Send for Operation<Handler, Params>
where Handler: Send, PhantomData<fn(Params)>: Send,

§

impl<Handler, Params> Sync for Operation<Handler, Params>
where Handler: Sync, PhantomData<fn(Params)>: Sync,

§

impl<Handler, Params> Unpin for Operation<Handler, Params>
where Handler: Unpin, PhantomData<fn(Params)>: Unpin,

§

impl<Handler, Params> UnsafeUnpin for Operation<Handler, Params>
where Handler: UnsafeUnpin, PhantomData<fn(Params)>: UnsafeUnpin,

§

impl<Handler, Params> UnwindSafe for Operation<Handler, Params>
where Handler: UnwindSafe, PhantomData<fn(Params)>: UnwindSafe,

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<This> JsonRpcProgramExt<This> for This

Source§

fn compile_jsonrpc<Program>( &self, program: Program, ) -> <Program as JsonRpcProgramAlg<This>>::Methods
where Program: JsonRpcProgramAlg<This>,

Compiles a named JSON-RPC program with this interpreter.

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.