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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)