Skip to main content

SerialisableValue

Struct SerialisableValue 

Source
pub struct SerialisableValue<T, S>
where T: Send + Debug, S: Serialiser<T>,
{ pub v: T, pub ser: S, }
Expand description

A data type equivalent to a pair of value and a serialiser for it

Fields§

§v: T

The value to be serialised

§ser: S

The serialise to use

Implementations§

Source§

impl<T, S> SerialisableValue<T, S>
where T: Send + Debug + 'static, S: Serialiser<T>,

Source

pub fn new(v: T, ser: S) -> SerialisableValue<T, S>

Create a new Serialisable type from a T and a Serialiser for T

Source

pub fn from_tuple(t: (T, S)) -> SerialisableValue<T, S>

Create a new Serialisable type from a pair of T and a Serialiser for T

Trait Implementations§

Source§

impl<T, S> Debug for SerialisableValue<T, S>
where T: Send + Debug, S: Serialiser<T>,

Source§

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

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

impl<T, S> From<(T, S)> for SerialisableValue<T, S>
where T: Send + Debug + 'static, S: Serialiser<T> + 'static,

Turns a pair of a Serialiser and value of it’s type T into a stack-allocated Serialisable

Source§

fn from(t: (T, S)) -> SerialisableValue<T, S>

Converts to this type from the input type.
Source§

impl<T, S> Serialisable for SerialisableValue<T, S>
where T: Send + Debug + 'static, S: Serialiser<T> + 'static,

Source§

fn ser_id(&self) -> u64

The serialisation id for this serialisable Read more
Source§

fn size_hint(&self) -> Option<usize>

An indicator how many bytes must be reserved in a buffer for a value to be serialsed into it with this serialiser Read more
Source§

fn serialise(&self, buf: &mut dyn BufMut) -> Result<(), SerError>

Serialises this object (self) into buf Read more
Source§

fn local( self: Box<SerialisableValue<T, S>>, ) -> Result<Box<dyn Any + Send>, Box<dyn Serialisable>>

Try move this object onto the heap for reflection, instead of serialising Read more
Source§

fn cloned(&self) -> Option<Box<dyn Serialisable>>

Try to produce a cheap in-memory copy of this Read more
Source§

fn serialised(&self) -> Result<Serialised, SerError>

Serialise with a one-off buffer Read more

Auto Trait Implementations§

§

impl<T, S> Freeze for SerialisableValue<T, S>
where T: Freeze, S: Freeze,

§

impl<T, S> RefUnwindSafe for SerialisableValue<T, S>

§

impl<T, S> Send for SerialisableValue<T, S>

§

impl<T, S> Sync for SerialisableValue<T, S>
where T: Sync, S: Sync,

§

impl<T, S> Unpin for SerialisableValue<T, S>
where T: Unpin, S: Unpin,

§

impl<T, S> UnsafeUnpin for SerialisableValue<T, S>
where T: UnsafeUnpin, S: UnsafeUnpin,

§

impl<T, S> UnwindSafe for SerialisableValue<T, S>
where T: UnwindSafe, S: 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> DispatchEvent for T
where T: Any + Send + Debug,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any + Send>

Convert this event into an erased Any payload for downcasting.
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> Erased for T

Source§

impl<M> MessageBounds for M
where M: Debug + Send + 'static,

Source§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,