Skip to main content

Decode

Trait Decode 

Source
pub trait Decode {
    const ID: u64 = 0;

    // Required method
    fn decode(
        buf: Bytes,
        ctx: Option<&DecodeContext>,
    ) -> Result<Self, DecodeError>
       where Self: Sized;
}
Expand description

Describes how to decode a remote message.

Provided Associated Constants§

Source

const ID: u64 = 0

Message identifier. A remote message should have an unique identifier so the Handler<RemoteMessage> can dispatch the message to the proper handler.

Here unique means that for one particular actor type, the messages that can be handled by it must have unique identifiers, but two different actor can have messages share the same identifier.

The identifier in Encode and Decode must be the same for the same message type.

The derived implementation of Handler<RemoteMessage> relies on this identifier to work properly. If you do not use the derived implementation of Handler<RemoteMessage>, you can ignore this requirement and just use the default value.

(u64::MAX - 255) ~ u64::MAX is reserved for internal use.

Required Methods§

Source

fn decode(buf: Bytes, ctx: Option<&DecodeContext>) -> Result<Self, DecodeError>
where Self: Sized,

Decodes the remote message from the provided buffer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Decode for CronSignal

Source§

impl Decode for Signal

Source§

const ID: u64 = u64::MAX

Source§

fn decode(buf: Bytes, _ctx: Option<&DecodeContext>) -> Result<Self, DecodeError>

Source§

impl Decode for bool

Available on crate feature prost-codec only.
Source§

impl Decode for f32

Available on crate feature prost-codec only.
Source§

impl Decode for f64

Available on crate feature prost-codec only.
Source§

impl Decode for i8

Available on crate feature prost-codec only.
Source§

impl Decode for i16

Available on crate feature prost-codec only.
Source§

impl Decode for i32

Available on crate feature prost-codec only.
Source§

impl Decode for i64

Available on crate feature prost-codec only.
Source§

impl Decode for isize

Available on crate feature prost-codec only.
Source§

impl Decode for u8

Available on crate feature prost-codec only.
Source§

impl Decode for u16

Available on crate feature prost-codec only.
Source§

impl Decode for u32

Available on crate feature prost-codec only.
Source§

impl Decode for u64

Available on crate feature prost-codec only.
Source§

impl Decode for ()

Available on crate feature prost-codec only.
Source§

impl Decode for usize

Available on crate feature prost-codec only.
Source§

impl Decode for String

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<bool>

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<f32>

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<f64>

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<i8>

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<i16>

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<i32>

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<i64>

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<isize>

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<u8>

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<u16>

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<u32>

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<u64>

Available on crate feature prost-codec only.
Source§

impl Decode for Vec<usize>

Available on crate feature prost-codec only.
Source§

impl Decode for IpcMessage

Source§

impl<A> Decode for Supervisor<A>
where A: Actor,

Source§

impl<M> Decode for Observer<M>
where M: Message + Encode, M::Result: Decode,

Source§

impl<T0, T1> Decode for (T0, T1)
where T0: Decode, T1: Decode,

Available on crate feature prost-codec only.
Source§

impl<T0, T1, T2> Decode for (T0, T1, T2)
where T0: Decode, T1: Decode, T2: Decode,

Available on crate feature prost-codec only.
Source§

impl<T0, T1, T2, T3> Decode for (T0, T1, T2, T3)
where T0: Decode, T1: Decode, T2: Decode, T3: Decode,

Available on crate feature prost-codec only.
Source§

impl<T0, T1, T2, T3, T4> Decode for (T0, T1, T2, T3, T4)
where T0: Decode, T1: Decode, T2: Decode, T3: Decode, T4: Decode,

Available on crate feature prost-codec only.
Source§

impl<T0, T1, T2, T3, T4, T5> Decode for (T0, T1, T2, T3, T4, T5)
where T0: Decode, T1: Decode, T2: Decode, T3: Decode, T4: Decode, T5: Decode,

Available on crate feature prost-codec only.
Source§

impl<T0, T1, T2, T3, T4, T5, T6> Decode for (T0, T1, T2, T3, T4, T5, T6)
where T0: Decode, T1: Decode, T2: Decode, T3: Decode, T4: Decode, T5: Decode, T6: Decode,

Available on crate feature prost-codec only.
Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> Decode for (T0, T1, T2, T3, T4, T5, T6, T7)
where T0: Decode, T1: Decode, T2: Decode, T3: Decode, T4: Decode, T5: Decode, T6: Decode, T7: Decode,

Available on crate feature prost-codec only.
Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> Decode for (T0, T1, T2, T3, T4, T5, T6, T7, T8)
where T0: Decode, T1: Decode, T2: Decode, T3: Decode, T4: Decode, T5: Decode, T6: Decode, T7: Decode, T8: Decode,

Available on crate feature prost-codec only.
Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> Decode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
where T0: Decode, T1: Decode, T2: Decode, T3: Decode, T4: Decode, T5: Decode, T6: Decode, T7: Decode, T8: Decode, T9: Decode,

Available on crate feature prost-codec only.
Source§

impl<T> Decode for Option<T>
where T: Decode,

Source§

impl<T> Decode for Box<T>
where T: Decode,

Source§

const ID: u64 = T::ID

Source§

fn decode(buf: Bytes, ctx: Option<&DecodeContext>) -> Result<Self, DecodeError>

Source§

impl<T> Decode for Arc<T>
where T: Decode,

Source§

const ID: u64 = T::ID

Source§

fn decode(buf: Bytes, ctx: Option<&DecodeContext>) -> Result<Self, DecodeError>

Source§

impl<T, E> Decode for Result<T, E>
where T: Decode, E: From<String>,

Implementors§