Enum JsonValue
pub enum JsonValue {
Number(f64),
Boolean(bool),
String(String),
Null,
Array(Vec<JsonValue>),
Object(HashMap<String, JsonValue>),
}
Expand description
Enum to represent one JSON value. Each variant represents corresponding JSON types.
use tinyjson::JsonValue;
use std::convert::TryInto;
// Convert from raw values using `From` trait
let value = JsonValue::from("this is string".to_string());
// Get reference to inner value
let maybe_number: Option<&f64> = value.get();
assert!(maybe_number.is_none());
let maybe_string: Option<&String> = value.get();
assert!(maybe_string.is_some());
// Check type of JSON value
assert!(matches!(value, JsonValue::String(_)));
assert!(value.is_string());
// Convert into raw values using `TryInto` trait
let original_value: String = value.try_into().unwrap();
Variants§
Number(f64)
Number type value.
Boolean(bool)
Boolean type value.
String(String)
String type value.
Null
Null type value.
Array(Vec<JsonValue>)
Array type value.
Object(HashMap<String, JsonValue>)
Object type value.
Implementations§
§impl JsonValue
impl JsonValue
pub fn get<T>(&self) -> Option<&T>where
T: InnerAsRef,
pub fn get<T>(&self) -> Option<&T>where
T: InnerAsRef,
Get immutable reference to the inner value.
use tinyjson::JsonValue;
let value: JsonValue = "[1, 2, 3]".parse().unwrap();
let vec: &Vec<_> = value.get().unwrap();
assert_eq!(vec[0], JsonValue::from(1.0));
// Try to convert with incorrect type
assert!(value.get::<f64>().is_none());
pub fn get_mut<T>(&mut self) -> Option<&mut T>where
T: InnerAsRefMut,
pub fn get_mut<T>(&mut self) -> Option<&mut T>where
T: InnerAsRefMut,
Get mutable reference to the inner value.
use tinyjson::JsonValue;
let mut value: JsonValue = "[1, 2, 3]".parse().unwrap();
let vec: &mut Vec<_> = value.get_mut().unwrap();
vec[0] = JsonValue::from(false);
assert_eq!(value.stringify().unwrap(), "[false,2,3]");
// Try to convert with incorrect type
assert!(value.get_mut::<f64>().is_none());
pub fn is_bool(&self) -> bool
pub fn is_bool(&self) -> bool
Check if the inner value is a boolean.
use tinyjson::JsonValue;
let v = JsonValue::from(true);
assert!(v.is_bool());
let v = JsonValue::from(1.0);
assert!(!v.is_bool());
pub fn is_number(&self) -> bool
pub fn is_number(&self) -> bool
Check if the inner value is a number.
use tinyjson::JsonValue;
let v = JsonValue::from(1.0);
assert!(v.is_number());
let v = JsonValue::from(false);
assert!(!v.is_number());
pub fn is_string(&self) -> bool
pub fn is_string(&self) -> bool
Check if the inner value is a string.
use tinyjson::JsonValue;
let v = JsonValue::from("foo".to_string());
assert!(v.is_string());
let v = JsonValue::from(1.0);
assert!(!v.is_string());
pub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Check if the inner value is null.
use tinyjson::JsonValue;
let v = JsonValue::from(()); // () is inner representation of null value
assert!(v.is_null());
let v = JsonValue::from(false);
assert!(!v.is_null());
pub fn is_array(&self) -> bool
pub fn is_array(&self) -> bool
Check if the inner value is an array.
use tinyjson::JsonValue;
let v = JsonValue::from(vec![]);
assert!(v.is_array());
let v = JsonValue::from(1.0);
assert!(!v.is_array());
pub fn is_object(&self) -> bool
pub fn is_object(&self) -> bool
Check if the inner value is an object.
use tinyjson::JsonValue;
use std::collections::HashMap;
let v = JsonValue::from(HashMap::new());
assert!(v.is_object());
let v = JsonValue::from(vec![]);
assert!(!v.is_object());
pub fn stringify(&self) -> Result<String, JsonGenerateError>
pub fn stringify(&self) -> Result<String, JsonGenerateError>
Convert this JSON value to String
value.
use tinyjson::JsonValue;
let v = JsonValue::from(vec![1.0.into(), true.into(), "str".to_string().into()]);
let s = v.stringify().unwrap();
assert_eq!(&s, "[1,true,\"str\"]");
pub fn write_to<W>(&self, w: &mut W) -> Result<(), Error>where
W: Write,
pub fn write_to<W>(&self, w: &mut W) -> Result<(), Error>where
W: Write,
Write this JSON value to the given io::Write
object as UTF-8 byte sequence.
use tinyjson::JsonValue;
use std::io::Write;
let v = JsonValue::from(vec![1.0.into(), true.into(), "str".to_string().into()]);
let mut bytes = vec![];
v.write_to(&mut bytes).unwrap();
assert_eq!(&String::from_utf8(bytes).unwrap(), "[1,true,\"str\"]");
pub fn format(&self) -> Result<String, JsonGenerateError>
pub fn format(&self) -> Result<String, JsonGenerateError>
Convert this JSON value to String
value with 2-spaces indentation.
use tinyjson::JsonValue;
let v = JsonValue::from(vec![1.0.into(), true.into(), "str".to_string().into()]);
let s = v.format().unwrap();
assert_eq!(&s,
"[
1,
true,
\"str\"
]");
pub fn format_to<W>(&self, w: &mut W) -> Result<(), Error>where
W: Write,
pub fn format_to<W>(&self, w: &mut W) -> Result<(), Error>where
W: Write,
Write this JSON value to the given io::Write
object as UTF-8 byte sequence with 2-spaces indentation.
use tinyjson::JsonValue;
let v = JsonValue::from(vec![1.0.into(), true.into(), "str".to_string().into()]);
let mut bytes = vec![];
v.format_to(&mut bytes).unwrap();
assert_eq!(&String::from_utf8(bytes).unwrap(),
"[
1,
true,
\"str\"
]");
Trait Implementations§
Source§impl From<&JsonNotification> for JsonValue
impl From<&JsonNotification> for JsonValue
Source§fn from(notif: &JsonNotification) -> JsonValue
fn from(notif: &JsonNotification) -> JsonValue
Source§impl From<&JsonRequest> for JsonValue
impl From<&JsonRequest> for JsonValue
Source§fn from(req: &JsonRequest) -> JsonValue
fn from(req: &JsonRequest) -> JsonValue
Source§impl From<&JsonResponse> for JsonValue
impl From<&JsonResponse> for JsonValue
Source§fn from(rep: &JsonResponse) -> JsonValue
fn from(rep: &JsonResponse) -> JsonValue
§impl From<()> for JsonValue
impl From<()> for JsonValue
Convert ()
into JsonValue
. ()
is an inner representation of null JSON value.
use tinyjson::JsonValue;
let v = JsonValue::from(());
assert!(v.is_null());
Source§impl From<ChannelInfo> for JsonValue
impl From<ChannelInfo> for JsonValue
Source§fn from(info: ChannelInfo) -> JsonValue
fn from(info: ChannelInfo) -> JsonValue
§impl From<HashMap<String, JsonValue>> for JsonValue
impl From<HashMap<String, JsonValue>> for JsonValue
Convert HashMap
value into JsonValue
.
use tinyjson::JsonValue;
use std::collections::HashMap;
let mut m = HashMap::new();
m.insert("foo".to_string(), 1.0.into());
let v = JsonValue::from(m);
assert!(v.is_object());
Source§impl From<InboundInfo> for JsonValue
impl From<InboundInfo> for JsonValue
Source§fn from(info: InboundInfo) -> JsonValue
fn from(info: InboundInfo) -> JsonValue
Source§impl From<MessageInfo> for JsonValue
impl From<MessageInfo> for JsonValue
Source§fn from(info: MessageInfo) -> JsonValue
fn from(info: MessageInfo) -> JsonValue
Source§impl From<MessageInfo> for JsonValue
impl From<MessageInfo> for JsonValue
Source§fn from(info: MessageInfo) -> JsonValue
fn from(info: MessageInfo) -> JsonValue
Source§impl From<OutboundPeerDiscovery> for JsonValue
impl From<OutboundPeerDiscovery> for JsonValue
Source§fn from(info: OutboundPeerDiscovery) -> JsonValue
fn from(info: OutboundPeerDiscovery) -> JsonValue
Source§impl From<OutboundSlotConnected> for JsonValue
impl From<OutboundSlotConnected> for JsonValue
Source§fn from(info: OutboundSlotConnected) -> JsonValue
fn from(info: OutboundSlotConnected) -> JsonValue
Source§impl From<OutboundSlotConnecting> for JsonValue
impl From<OutboundSlotConnecting> for JsonValue
Source§fn from(info: OutboundSlotConnecting) -> JsonValue
fn from(info: OutboundSlotConnecting) -> JsonValue
Source§impl From<OutboundSlotDisconnected> for JsonValue
impl From<OutboundSlotDisconnected> for JsonValue
Source§fn from(info: OutboundSlotDisconnected) -> JsonValue
fn from(info: OutboundSlotDisconnected) -> JsonValue
Source§impl From<OutboundSlotSleeping> for JsonValue
impl From<OutboundSlotSleeping> for JsonValue
Source§fn from(info: OutboundSlotSleeping) -> JsonValue
fn from(info: OutboundSlotSleeping) -> JsonValue
§impl From<String> for JsonValue
impl From<String> for JsonValue
Convert bool
value into JsonValue
. Note that &str
is not available. Explicitly allocate String
object
and pass it.
use tinyjson::JsonValue;
let v = JsonValue::from("foo".to_string());
assert!(v.is_string());
§impl From<UnexpectedValue> for JsonValue
impl From<UnexpectedValue> for JsonValue
Convert this error into the value which failed to be converted.
use tinyjson::JsonValue;
use std::convert::TryFrom;
let error = String::try_from(JsonValue::from(1.0)).unwrap_err();
assert_eq!(JsonValue::from(error), JsonValue::Number(1.0));
§impl From<Vec<JsonValue>> for JsonValue
impl From<Vec<JsonValue>> for JsonValue
Convert Vec
value into JsonValue
.
use tinyjson::JsonValue;
let v = JsonValue::from(vec![1.0.into(), true.into()]);
assert!(v.is_array());
§impl From<bool> for JsonValue
impl From<bool> for JsonValue
Convert bool
value into JsonValue
.
use tinyjson::JsonValue;
let v = JsonValue::from(true);
assert!(v.is_bool());
§impl From<f64> for JsonValue
impl From<f64> for JsonValue
Convert f64
value into JsonValue
.
use tinyjson::JsonValue;
let v = JsonValue::from(1.0);
assert!(v.is_number());
§impl FromStr for JsonValue
impl FromStr for JsonValue
Parse given str
object into JsonValue
value. This is recommended way to parse strings into JSON value with
this library.
use tinyjson::JsonValue;
let array: JsonValue = "[1, 2, 3]".parse().unwrap();
assert!(array.is_array());
§impl<'a> Index<&'a str> for JsonValue
impl<'a> Index<&'a str> for JsonValue
Access to value of the key of object.
use tinyjson::JsonValue;
use std::collections::HashMap;
let mut m = HashMap::new();
m.insert("foo".to_string(), 1.0.into());
let v = JsonValue::from(m);
let i = &v["foo"];
assert_eq!(i, &JsonValue::Number(1.0));
This will panic when the given JsonValue
value is not an object
let v = JsonValue::from(vec![]);
let _ = &v["foo"]; // Panic
or when the key does not exist in the object.
let v = JsonValue::from(HashMap::new());
let _ = &v["foo"]; // Panic
Using this operator, you can access the nested elements quickly
let mut json: JsonValue = r#"
{
"foo": {
"bar": [
{ "target": 42 }
]
}
}
"#.parse().unwrap();
// Access with index operator
let target_value: f64 = *json["foo"]["bar"][0]["target"].get().unwrap();
assert_eq!(target_value, 42.0);
§impl Index<usize> for JsonValue
impl Index<usize> for JsonValue
Access to value of the index of array.
use tinyjson::JsonValue;
let v = JsonValue::from(vec![1.0.into(), true.into()]);
let b = &v[1];
assert_eq!(b, &JsonValue::Boolean(true));
This will panic when the given JsonValue
value is not an array
use std::collections::HashMap;
let v = JsonValue::from(HashMap::new());
let _ = &v[0]; // Panic
or when the index is out of bounds.
let v = JsonValue::from(vec![]);
let _ = &v[0]; // Panic
§impl<'a> IndexMut<&'a str> for JsonValue
impl<'a> IndexMut<&'a str> for JsonValue
Access to value of the key of mutable object.
use tinyjson::JsonValue;
use std::collections::HashMap;
let mut m = HashMap::new();
m.insert("foo".to_string(), 1.0.into());
let mut v = JsonValue::from(m);
v["foo"] = JsonValue::Number(3.14);
assert_eq!(v["foo"], JsonValue::Number(3.14));
This will panic when the given JsonValue
value is not an object
let mut v = JsonValue::from(vec![]);
let _ = &mut v["foo"]; // Panic
or when the key does not exist in the object.
let mut v = JsonValue::from(HashMap::new());
let _ = &mut v["foo"]; // Panic
Using this operator, you can modify the nested elements quickly
let mut json: JsonValue = r#"
{
"foo": {
"bar": [
{ "target": 42 }
]
}
}
"#.parse().unwrap();
// Modify with index operator
json["foo"]["bar"][0]["target"] = JsonValue::Boolean(false);
assert_eq!(json["foo"]["bar"][0]["target"], JsonValue::Boolean(false));
§impl IndexMut<usize> for JsonValue
impl IndexMut<usize> for JsonValue
Access to value of the index of mutable array.
use tinyjson::JsonValue;
let mut v = JsonValue::from(vec![1.0.into(), true.into()]);
let b = &mut v[1];
assert_eq!(b, &JsonValue::Boolean(true));
This will panic when the given JsonValue
value is not an array
use std::collections::HashMap;
let mut v = JsonValue::from(HashMap::new());
let _ = &mut v[0]; // Panic
or when the index is out of bounds.
let mut v = JsonValue::from(vec![]);
let _ = &mut v[0]; // Panic
Source§impl TryFrom<&JsonValue> for JsonNotification
impl TryFrom<&JsonValue> for JsonNotification
Source§impl TryFrom<&JsonValue> for JsonRequest
impl TryFrom<&JsonValue> for JsonRequest
Source§impl TryFrom<&JsonValue> for JsonResponse
impl TryFrom<&JsonValue> for JsonResponse
§impl TryFrom<JsonValue> for String
impl TryFrom<JsonValue> for String
Try to convert the JsonValue
value into String
. UnexpectedValue
error happens when trying to convert an
incorrect type value.
use tinyjson::JsonValue;
use std::convert::TryFrom;
let v = JsonValue::from("foo".to_string());
let r = String::try_from(v);
assert!(r.is_ok());
let v = JsonValue::from(1.0);
let r = String::try_from(v);
assert!(r.is_err());
§impl TryFrom<JsonValue> for Vec<JsonValue>
impl TryFrom<JsonValue> for Vec<JsonValue>
Try to convert the JsonValue
value into Vec<JsonValue>
. UnexpectedValue
error happens when trying to
convert an incorrect type value.
use tinyjson::JsonValue;
use std::convert::TryFrom;
let v = JsonValue::from(vec![true.into()]);
let r = <Vec<_>>::try_from(v);
assert!(r.is_ok());
let v = JsonValue::from(1.0);
let r = <Vec<_>>::try_from(v);
assert!(r.is_err());
§impl TryFrom<JsonValue> for bool
impl TryFrom<JsonValue> for bool
Try to convert the JsonValue
value into bool
. UnexpectedValue
error happens when trying to convert an
incorrect type value.
use tinyjson::JsonValue;
use std::convert::TryFrom;
let v = JsonValue::from(true);
let r = bool::try_from(v);
assert!(r.is_ok());
let v = JsonValue::from(1.0);
let r = bool::try_from(v);
assert!(r.is_err());
impl StructuralPartialEq for JsonValue
Auto Trait Implementations§
impl Freeze for JsonValue
impl RefUnwindSafe for JsonValue
impl Send for JsonValue
impl Sync for JsonValue
impl Unpin for JsonValue
impl UnwindSafe for JsonValue
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.