NakedValue

Struct NakedValue 

Source
pub struct NakedValue<'a>(pub &'a Value);
Expand description

A value reference that formats without type tags

Tuple Fields§

§0: &'a Value

Methods from Deref<Target = Value>§

Source

pub fn to_string_naked(&self) -> String

Source

pub fn fmt_naked(&self, f: &mut Formatter<'_>) -> Result

Source

pub fn fmt_notyp(&self, f: &mut Formatter<'_>) -> Result

Source

pub fn fmt_ext( &self, f: &mut Formatter<'_>, esc: &Escape, types: bool, ) -> Result

Source

pub fn approx_eq(&self, v: &Self) -> bool

Source

pub fn discriminant(&self) -> u64

return the discriminant tag of this value

Source

pub fn is_copy(&self) -> bool

return true if this value will be cloned by a direct bitwise copy

Source

pub fn downcast_ref<T: Any + Send + Sync>(&self) -> Option<&T>

downcast an abstract value to it’s concrete type

return None if the value isn’t abstract, or if T is not it’s concrete type.

Source

pub unsafe fn get_as_unchecked<T>(&self) -> &T

get a reference to the payload of the value without checking the tag

If you are wrong about what kind of value you have then this could cause undefined behavior.

Source

pub fn number(&self) -> bool

return true if the value is some kind of number, otherwise false.

Source

pub fn integer(&self) -> bool

return true if the value is some kind of integer, otherwise false.

Trait Implementations§

Source§

impl<'a> Deref for NakedValue<'a>

Source§

type Target = Value

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'a> Display for NakedValue<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for NakedValue<'a>

§

impl<'a> !RefUnwindSafe for NakedValue<'a>

§

impl<'a> Send for NakedValue<'a>

§

impl<'a> Sync for NakedValue<'a>

§

impl<'a> Unpin for NakedValue<'a>

§

impl<'a> !UnwindSafe for NakedValue<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToCompactString for T
where T: Display,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.