pub struct PortableRegistry {
pub types: Vec<PortableType>,
}
Expand description
A read-only registry containing types in their portable form for serialization.
Fields§
§types: Vec<PortableType>
The types contained by the PortableRegistry
.
Implementations§
Source§impl PortableRegistry
impl PortableRegistry
Sourcepub fn resolve(&self, id: u32) -> Option<&Type<PortableForm>>
pub fn resolve(&self, id: u32) -> Option<&Type<PortableForm>>
Returns the type definition for the given identifier, None
if no type found for that ID.
Sourcepub fn types(&self) -> &[PortableType]
👎Deprecated since 2.5.0: Prefer to access the fields directly; this getter will be removed in the next major version
pub fn types(&self) -> &[PortableType]
Returns all types with their associated identifiers.
Sourcepub fn retain<F>(&mut self, filter: F) -> BTreeMap<u32, u32>
pub fn retain<F>(&mut self, filter: F) -> BTreeMap<u32, u32>
Retains only the portable types needed to express the provided ids.
The type IDs retained are returned as key to the BTreeMap
.
The value of the map represents the new ID of that type.
§Note
A given type ID can be defined by nesting type IDs, such as the case
of a TypeDef::Composite
and others. To retain a valid PortableRegistry
all the types needed to express an ID are included. Therefore, the number of
elements defined by the result equals or exceeds the number of provided IDs.
Trait Implementations§
Source§impl Clone for PortableRegistry
impl Clone for PortableRegistry
Source§fn clone(&self) -> PortableRegistry
fn clone(&self) -> PortableRegistry
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PortableRegistry
impl Debug for PortableRegistry
Source§impl Decode for PortableRegistry
impl Decode for PortableRegistry
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Attempt to deserialise the value from input.
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl Encode for PortableRegistry
impl Encode for PortableRegistry
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
Source§fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>(
&self,
f: __CodecUsingEncodedCallback,
) -> __CodecOutputReturn
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn
Convert self to a slice and then invoke the given closure with it.
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Source§impl From<Registry> for PortableRegistry
impl From<Registry> for PortableRegistry
Source§impl PartialEq for PortableRegistry
impl PartialEq for PortableRegistry
impl EncodeLike for PortableRegistry
impl Eq for PortableRegistry
impl StructuralPartialEq for PortableRegistry
Auto Trait Implementations§
impl Freeze for PortableRegistry
impl RefUnwindSafe for PortableRegistry
impl Send for PortableRegistry
impl Sync for PortableRegistry
impl Unpin for PortableRegistry
impl UnwindSafe for PortableRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more