pub struct Key(/* private fields */);
Expand description
The Key
uniquely identifies what “kind” of message this is.
In order to generate it, postcard-schema
takes two pieces of data:
- a
&str
“path” URI, similar to how you would use URIs as part of an HTTP path - The schema of the message type itself, using the
Schema
trait
Specifically, we use Fnv1a
,
and produce a 64-bit digest, by first hashing the path, then hashing the
schema. Fnv1a is a non-cryptographic hash function, designed to be reasonably
efficient to compute even on small platforms like microcontrollers.
Changing anything about either of the path or the schema will produce
a drastically different Key
value.
Implementations§
Source§impl Key
impl Key
Source§impl Key
impl Key
Sourcepub fn for_owned_schema_path(path: &str, nt: &OwnedNamedType) -> Key
pub fn for_owned_schema_path(path: &str, nt: &OwnedNamedType) -> Key
Calculate the Key for the given path and OwnedNamedType
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Key
impl<'de> Deserialize<'de> for Key
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Key, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Key, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Key
impl Ord for Key
Source§impl PartialOrd for Key
impl PartialOrd for Key
Source§impl Serialize for Key
impl Serialize for Key
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Key
impl Eq for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnwindSafe for Key
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