pub struct NonNil<T>(pub T);Expand description
A slice or map Go builds non-nil even when empty: encodes [] / {}.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: GoJson> GoJson for NonNil<Vec<T>>
impl<T: GoJson> GoJson for NonNil<Vec<T>>
Source§const NULL_CLEARS: bool = true
const NULL_CLEARS: bool = true
Whether
null resets the field (slices, maps, pointers, any); scalars and
structs keep their value.Source§fn go_type() -> String
fn go_type() -> String
The Go type as decode errors spell it; containers name their element type
(
[]string, map[string]interface {}).Source§fn decode_into(&mut self, v: &Node) -> Result<(), DecodeError>
fn decode_into(&mut self, v: &Node) -> Result<(), DecodeError>
json.Unmarshal into an existing value. null resets slices, maps, pointers and
any, and leaves everything else alone.Source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Go
omitempty: false, 0, “”, nil or empty slices and maps, nil pointers. Structs
(including time.Time) are never empty.Source§fn decode_value(v: &Node) -> Result<Self, DecodeError>
fn decode_value(v: &Node) -> Result<Self, DecodeError>
Decodes a non-null value from scratch. Implement this or
Self::decode_into.Source§impl<T: GoJson> GoJson for NonNil<BTreeMap<String, T>>
impl<T: GoJson> GoJson for NonNil<BTreeMap<String, T>>
Source§const NULL_CLEARS: bool = true
const NULL_CLEARS: bool = true
Whether
null resets the field (slices, maps, pointers, any); scalars and
structs keep their value.Source§fn go_type() -> String
fn go_type() -> String
The Go type as decode errors spell it; containers name their element type
(
[]string, map[string]interface {}).Source§fn decode_into(&mut self, v: &Node) -> Result<(), DecodeError>
fn decode_into(&mut self, v: &Node) -> Result<(), DecodeError>
json.Unmarshal into an existing value. null resets slices, maps, pointers and
any, and leaves everything else alone.Source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Go
omitempty: false, 0, “”, nil or empty slices and maps, nil pointers. Structs
(including time.Time) are never empty.Source§fn decode_value(v: &Node) -> Result<Self, DecodeError>
fn decode_value(v: &Node) -> Result<Self, DecodeError>
Decodes a non-null value from scratch. Implement this or
Self::decode_into.impl<T: PartialEq> StructuralPartialEq for NonNil<T>
Auto Trait Implementations§
impl<T> Forget for NonNil<T>
impl<T> Freeze for NonNil<T>where
T: Freeze,
impl<T> Move for NonNil<T>
impl<T> RefUnwindSafe for NonNil<T>where
T: RefUnwindSafe,
impl<T> Send for NonNil<T>where
T: Send,
impl<T> Sync for NonNil<T>where
T: Sync,
impl<T> Unpin for NonNil<T>where
T: Unpin,
impl<T> UnsafeUnpin for NonNil<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for NonNil<T>where
T: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more