#[repr(transparent)]pub struct Leaf<T: ?Sized>(pub T);
Expand description
Serialize
/Deserialize
/Any
leaf
This wraps Serialize
, Deserialize
, and Any
into Tree
a leaf node.
use miniconf::{json, Leaf, Tree};
let mut s = Leaf(0);
json::set(&mut s, "", b"7").unwrap();
assert!(matches!(*s, 7));
Tuple Fields§
§0: T
Implementations§
source§impl<T> Leaf<T>
impl<T> Leaf<T>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Extract just the inner
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for Leaf<T>where
T: Deserialize<'de> + ?Sized,
impl<'de, T> Deserialize<'de> for Leaf<T>where
T: Deserialize<'de> + ?Sized,
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
source§impl<T: PartialOrd + ?Sized> PartialOrd for Leaf<T>
impl<T: PartialOrd + ?Sized> PartialOrd for Leaf<T>
source§impl<T: Any> TreeAny for Leaf<T>
impl<T: Any> TreeAny for Leaf<T>
source§fn ref_any_by_key<K>(&self, keys: K) -> Result<&dyn Any, Traversal>where
K: Keys,
fn ref_any_by_key<K>(&self, keys: K) -> Result<&dyn Any, Traversal>where
K: Keys,
Obtain a reference to a
dyn Any
trait object for a leaf node.source§fn mut_any_by_key<K>(&mut self, keys: K) -> Result<&mut dyn Any, Traversal>where
K: Keys,
fn mut_any_by_key<K>(&mut self, keys: K) -> Result<&mut dyn Any, Traversal>where
K: Keys,
Obtain a mutable reference to a
dyn Any
trait object for a leaf node.source§impl<'de, T: Deserialize<'de>> TreeDeserialize<'de> for Leaf<T>
impl<'de, T: Deserialize<'de>> TreeDeserialize<'de> for Leaf<T>
source§fn deserialize_by_key<K, D>(
&mut self,
keys: K,
de: D,
) -> Result<usize, Error<D::Error>>where
K: Keys,
D: Deserializer<'de>,
fn deserialize_by_key<K, D>(
&mut self,
keys: K,
de: D,
) -> Result<usize, Error<D::Error>>where
K: Keys,
D: Deserializer<'de>,
Deserialize a leaf node by its keys. Read more
source§impl<T: ?Sized> TreeKey for Leaf<T>
impl<T: ?Sized> TreeKey for Leaf<T>
source§impl<T: Serialize + ?Sized> TreeSerialize for Leaf<T>
impl<T: Serialize + ?Sized> TreeSerialize for Leaf<T>
source§fn serialize_by_key<K, S>(
&self,
keys: K,
ser: S,
) -> Result<usize, Error<S::Error>>where
K: Keys,
S: Serializer,
fn serialize_by_key<K, S>(
&self,
keys: K,
ser: S,
) -> Result<usize, Error<S::Error>>where
K: Keys,
S: Serializer,
Serialize a node by keys. Read more
impl<T: Copy + ?Sized> Copy for Leaf<T>
impl<T: Eq + ?Sized> Eq for Leaf<T>
impl<T: ?Sized> StructuralPartialEq for Leaf<T>
Auto Trait Implementations§
impl<T> Freeze for Leaf<T>
impl<T> RefUnwindSafe for Leaf<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Send for Leaf<T>
impl<T> Sync for Leaf<T>
impl<T> Unpin for Leaf<T>
impl<T> UnwindSafe for Leaf<T>where
T: UnwindSafe + ?Sized,
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
)