pub enum Id<'a> {
Null,
Number(u64),
Str(Cow<'a, str>),
}Expand description
Request Id
Variants§
Implementations§
Source§impl Id<'_>
impl Id<'_>
Sourcepub fn as_number(&self) -> Option<&u64>
pub fn as_number(&self) -> Option<&u64>
If the Id is a number, returns the associated number. Returns None otherwise.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
If the Id is a String, returns the associated str. Returns None otherwise.
Sourcepub fn into_owned(self) -> Id<'static>
pub fn into_owned(self) -> Id<'static>
Convert Id<'a> to Id<'static> so that it can be moved across threads.
This can cause an allocation if the id is a string.
Trait Implementations§
Source§impl<'de: 'a, 'a> Deserialize<'de> for Id<'a>
Parses the id without buffering it: the untagged derive would first copy a peer-supplied array
or object into an intermediate tree before rejecting it.
impl<'de: 'a, 'a> Deserialize<'de> for Id<'a>
Parses the id without buffering it: the untagged derive would first copy a peer-supplied array or object into an intermediate tree before rejecting it.
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<'a> Eq for Id<'a>
Source§impl<'a> Ord for Id<'a>
impl<'a> Ord for Id<'a>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<'a> PartialOrd for Id<'a>
impl<'a> PartialOrd for Id<'a>
impl<'a> StructuralPartialEq for Id<'a>
Auto Trait Implementations§
impl<'a> Freeze for Id<'a>
impl<'a> RefUnwindSafe for Id<'a>
impl<'a> Send for Id<'a>
impl<'a> Sync for Id<'a>
impl<'a> Unpin for Id<'a>
impl<'a> UnsafeUnpin for Id<'a>
impl<'a> UnwindSafe for Id<'a>
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes
Size for each variant:
Null: 0 bytesNumber: 16 bytesStr: 24 bytes