Enum binn_ir::Value

source ·
pub enum Value {
Show 22 variants Null, True, False, U8(u8), I8(i8), U16(u16), I16(i16), U32(u32), I32(i32), U64(u64), I64(i64), Float(f32), Double(f64), Text(String), DateTime(String), Date(String), Time(String), DecimalStr(String), Blob(Blob), List(List), Map(Map), Object(Object),
}
Expand description

Values

Usage

Converting data into Value

This is straightforward. You can make this enum directly, or via implementations of From, FromIterator

Extracting data from Value

There are several options:

  • By using the good old match.
  • Or implementations of TryFrom.
  • Or via shortcut functions.

For numbers, if your have a strict specification of your data, it’s better to use match. Otherwise, you can use TryFrom implementations.

Variants§

§

Null

Shortcuts

§

True

Shortcuts

§

False

Shortcuts

§

U8(u8)

§

I8(i8)

§

U16(u16)

§

I16(i16)

§

U32(u32)

§

I32(i32)

§

U64(u64)

§

I64(i64)

§

Float(f32)

§

Double(f64)

§

Text(String)

Shortcuts

§

DateTime(String)

Shortcuts

§

Date(String)

Shortcuts

§

Time(String)

Shortcuts

§

DecimalStr(String)

(Decimal string)

Shortcuts

§

Blob(Blob)

Shortcuts

§

List(List)

Shortcuts

§

Map(Map)

Shortcuts

§

Object(Object)

Shortcuts

Notes

Implementations§

source§

impl Value

source

pub fn as_blob(&self) -> Result<&[u8]>

If the value is a blob, returns an immutable reference of it

Returns an error if the value is not a blob.

source

pub fn as_mut_blob(&mut self) -> Result<&mut Blob>

If the value is a blob, returns a mutable reference of it

Returns an error if the value is not a blob.

source§

impl Value

source

pub fn is_true(&self) -> Result<bool>

If the value is a boolean, returns it

Returns an error if the value is not a boolean.

Examples
use binn_ir::Value;

assert!(Value::True.is_true()?);
assert!(Value::False.is_true()? == false);
assert!(Value::Null.is_true().is_err());
source§

impl Value

source

pub fn push<T>(&mut self, value: T) -> Result<()>where T: Into<Self>,

If the value is a list, pushes new item into it

Returns an error if the value is not a list.

source

pub fn at(&self, indexes: &[usize]) -> Result<&Self>

Gets an immutable item from this list and its sub lists

The function returns an error on one of these conditions:

  • Indexes are empty or invalid.
  • The value or any of its sub items is not a list.
Examples
use binn_ir::Value;

let mut list = binn_ir::list();
list.push("first")?;
list.push(vec![Value::False, "second".into()])?;

assert_eq!(list.at(&[0])?.as_text()?, "first");
assert_eq!(list.at(&[1, 1])?.as_text()?, "second");

assert!(list.at(&[]).is_err());
assert!(list.at(&[0, 1]).is_err());
assert!(list.at(&[1, 2]).is_err());
assert!(list.at(&[1, 0, 0]).is_err());
assert!(list.at(&[1, 1, 2]).is_err());
source

pub fn mut_at(&mut self, indexes: &[usize]) -> Result<&mut Self>

Gets a mutable item from this array and its sub arrays

The function returns an error on one of these conditions:

  • Indexes are empty or invalid.
  • The value or any of its sub items is not an array.
source

pub fn take_at(&mut self, indexes: &[usize]) -> Result<Self>

Takes an item from this list and its sub lists

The function returns an error on one of these conditions:

  • Indexes are empty or invalid.
  • The value or any of its sub items is not a list.
Examples
use binn_ir::Value;

let mut list = binn_ir::list();
list.push("earth")?;
list.push(vec![Value::False, "moon".into()])?;

assert_eq!(list.take_at(&[0])?.as_text()?, "earth");
assert_eq!(list.take_at(&[0, 1])?.as_text()?, "moon");

assert!(list.take_at(&[]).is_err());
assert!(list.take_at(&[0, 1]).is_err());
source

pub fn as_list(&self) -> Result<&List>

If the value is a list, returns an immutable reference of it

Returns an error if the value is not a list.

source

pub fn as_mut_list(&mut self) -> Result<&mut List>

If the value is a list, returns a mutable reference of it

Returns an error if the value is not a list.

source§

impl Value

source

pub fn map_insert<K, V>(&mut self, key: K, value: V) -> Result<Option<Self>>where K: Into<MapKey>, V: Into<Self>,

If the value is a map, inserts new item into it

On success, returns previous value (if it existed).

Returns an error if the value is not a map.

source

pub fn map_by(&self, keys: &[MapKey]) -> Result<&Self>

Gets an immutable item from this map and its sub maps

The function returns an error on one of these conditions:

  • Keys are empty.
  • The value or any of its sub items is not a map.
Examples
let mut map = binn_ir::map();
map.map_insert(0, true)?;
map.map_insert(1, {
    let mut map = binn_ir::Map::new();
    binn_ir::map_insert(&mut map, 2, 99);
    map
})?;

assert_eq!(bool::try_from(map.map_by(&[0])?)?, true);
assert_eq!(u8::try_from(map.map_by(&[1, 2])?)?, 99);

assert!(map.map_by(&[2]).is_err());
assert!(map.map_maybe_by(&[2])?.is_none());

assert!(map.map_by(&[]).is_err());
assert!(map.map_by(&[0, 2]).is_err());
assert!(map.map_by(&[1, 2, 3]).is_err());
source

pub fn map_maybe_by(&self, keys: &[MapKey]) -> Result<Option<&Self>>

Gets an optional immutable item from this map and its sub maps

The function returns an error on one of these conditions:

  • Keys are empty.
  • The value or any of its sub items is not a map.
source

pub fn map_mut_by(&mut self, keys: &[MapKey]) -> Result<&mut Self>

Gets a mutable item from this map and its sub maps

The function returns an error on one of these conditions:

  • Keys are empty.
  • The value or any of its sub items is not a map.
source

pub fn map_maybe_mut_by(&mut self, keys: &[MapKey]) -> Result<Option<&mut Self>>

Gets an optional mutable item from this map and its sub maps

The function returns an error on one of these conditions:

  • Keys are empty.
  • The value or any of its sub items is not a map.
source

pub fn map_take_by(&mut self, keys: &[MapKey]) -> Result<Self>

Takes an item from this map and its sub maps

The function returns an error on one of these conditions:

  • Keys are empty.
  • The value or any of its sub items is not a map.
Examples
let mut map = binn_ir::map();
map.map_insert(0, "zero")?;
map.map_insert(1, {
    let mut map = binn_ir::Map::new();
    binn_ir::map_insert(&mut map, 2, "two");
    map
})?;

assert_eq!(map.map_take_by(&[0])?.as_text()?, "zero");
assert_eq!(map.map_take_by(&[1, 2])?.as_text()?, "two");

assert!(map.map_take_by(&[0]).is_err());
assert!(map.map_maybe_take_by(&[0])?.is_none());
assert!(map.map_maybe_take_by(&[1, 2])?.is_none());

assert!(map.map_take_by(&[]).is_err());
assert!(map.map_take_by(&[3, 4]).is_err());
source

pub fn map_maybe_take_by(&mut self, keys: &[MapKey]) -> Result<Option<Self>>

Takes an optional item from this map and its sub maps

The function returns an error on one of these conditions:

  • Keys are empty.
  • The value or any of its sub items is not a map.
source

pub fn as_map(&self) -> Result<&Map>

If the value is a map, returns an immutable reference of it

Returns an error if the value is not a map.

source

pub fn as_mut_map(&mut self) -> Result<&mut Map>

If the value is a map, returns a mutable reference of it

Returns an error if the value is not a map.

source§

impl Value

source

pub fn is_null(&self) -> bool

source

pub fn try_into_or<T>(self, default: T) -> Result<T>where T: TryFrom<Self, Error = Error>,

Tries to convert this value into something

If this is Null, returns default.

If your default value would be a result of a function call, you should use try_into_or_else().

Examples
assert!(binn_ir::Value::Null.try_into_or(true)?);
source

pub fn try_into_or_else<T, F>(self, default: F) -> Result<T>where T: TryFrom<Self, Error = Error>, F: FnOnce() -> T,

Tries to convert this value into something

If this is Null, calls default() and returns its result.

source

pub fn try_ref_into_or<'a, T>(&'a self, default: T) -> Result<T>where T: TryFrom<&'a Self, Error = Error>,

Tries to convert a reference of this value into something

If this is Null, returns default.

If your default value would be a result of a function call, you should use try_ref_into_or_else().

Examples
assert_eq!(binn_ir::Value::Null.try_ref_into_or(0)?, 0);
source

pub fn try_ref_into_or_else<'a, T, F>(&'a self, default: F) -> Result<T>where T: TryFrom<&'a Self, Error = Error>, F: FnOnce() -> T,

Tries to convert a reference of this value into something

If this is Null, calls default() and returns its result.

source§

impl Value

source

pub fn object_insert<K, V>(&mut self, key: K, value: V) -> Result<Option<Value>>where K: Into<ObjectKey>, V: Into<Self>,

If the value is an object, inserts new item into it

On success, returns previous value (if it existed).

Returns an error if the value is not an object.

source

pub fn object_by(&self, keys: &[&str]) -> Result<&Self>

Gets an immutable item from this object and its sub objects

The function returns an error on one of these conditions:

  • Keys are empty.
  • The value or any of its sub items is not an object.
Examples
let mut object = binn_ir::object();
object.object_insert("zero", true)?;
object.object_insert("one", {
    let mut object = binn_ir::Object::new();
    binn_ir::object_insert(&mut object, "two", 99);
    object
})?;

assert_eq!(bool::try_from(object.object_by(&["zero"])?)?, true);
assert_eq!(u8::try_from(object.object_by(&["one", "two"])?)?, 99);

assert!(object.object_by(&["two"]).is_err());
assert!(object.object_maybe_by(&["two"])?.is_none());

assert!(object.object_by(&[]).is_err());
assert!(object.object_by(&["zero", "two"]).is_err());
assert!(object.object_by(&["one", "two", "three"]).is_err());
source

pub fn object_maybe_by(&self, keys: &[&str]) -> Result<Option<&Self>>

Gets an optional immutable item from this object and its sub objects

The function returns an error on one of these conditions:

  • Keys are empty.
  • The value or any of its sub items is not an object.
source

pub fn object_mut_by(&mut self, keys: &[&str]) -> Result<&mut Self>

Gets a mutable item from this object and its sub objects

The function returns an error on one of these conditions:

  • Keys are empty.
  • The value or any of its sub items is not an object.
source

pub fn object_maybe_mut_by(&mut self, keys: &[&str]) -> Result<Option<&mut Self>>

Gets an optional mutable item from this object and its sub objects

The function returns an error on one of these conditions:

  • Keys are empty.
  • The value or any of its sub items is not an object.
source

pub fn object_take_by(&mut self, keys: &[&str]) -> Result<Self>

Takes an item from this object and its sub objects

The function returns an error on one of these conditions:

  • Keys are empty.
  • The value or any of its sub items is not an object.
Examples
let mut object = binn_ir::object();
object.object_insert("first", "1st")?;
object.object_insert("second", {
    let mut object = binn_ir::Object::new();
    binn_ir::object_insert(&mut object, "third", "3rd");
    object
})?;

assert_eq!(object.object_take_by(&["first"])?.as_text()?, "1st");
assert_eq!(object.object_take_by(&["second", "third"])?.as_text()?, "3rd");

assert!(object.object_take_by(&["zero"]).is_err());
assert!(object.object_maybe_take_by(&["zero"])?.is_none());
assert!(object.object_maybe_take_by(&["second", "fourth"])?.is_none());

assert!(object.object_take_by(&[]).is_err());
assert!(object.object_take_by(&["third", "fourth"]).is_err());
source

pub fn object_maybe_take_by(&mut self, keys: &[&str]) -> Result<Option<Self>>

Takes an optional item from this object and its sub objects

The function returns an error on one of these conditions:

  • Keys are empty.
  • The value or any of its sub items is not an object.
source

pub fn as_object(&self) -> Result<&Object>

If the value is an object, returns an immutable reference of it

Returns an error if the value is not an object.

source

pub fn as_mut_object(&mut self) -> Result<&mut Object>

If the value is an object, returns a mutable reference of it

Returns an error if the value is not an object.

source§

impl Value

source

pub fn as_text(&self) -> Result<&str>

source

pub fn as_date_time(&self) -> Result<&str>

source

pub fn as_date(&self) -> Result<&str>

source

pub fn as_time(&self) -> Result<&str>

source

pub fn as_decimal_str(&self) -> Result<&str>

source§

impl Value

source

pub fn size(&self) -> Result<Size>

source

pub fn encode<W>(&self, stream: &mut W) -> IoResult<Size>where W: Write,

Encodes this value into a stream

Returns the number of bytes written.

Trait Implementations§

source§

impl Clone for Value

source§

fn clone(&self) -> Value

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Value

source§

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

Formats the value using the given formatter. Read more
source§

impl From<&f32> for Value

source§

fn from(n: &f32) -> Self

Converts to this type from the input type.
source§

impl From<&f64> for Value

source§

fn from(n: &f64) -> Self

Converts to this type from the input type.
source§

impl From<&i16> for Value

source§

fn from(n: &i16) -> Self

Converts to this type from the input type.
source§

impl From<&i32> for Value

source§

fn from(n: &i32) -> Self

Converts to this type from the input type.
source§

impl From<&i64> for Value

source§

fn from(n: &i64) -> Self

Converts to this type from the input type.
source§

impl From<&i8> for Value

source§

fn from(n: &i8) -> Self

Converts to this type from the input type.
source§

impl From<&str> for Value

source§

fn from(s: &str) -> Self

Converts to this type from the input type.
source§

impl From<&u16> for Value

source§

fn from(n: &u16) -> Self

Converts to this type from the input type.
source§

impl From<&u32> for Value

source§

fn from(n: &u32) -> Self

Converts to this type from the input type.
source§

impl From<&u64> for Value

source§

fn from(n: &u64) -> Self

Converts to this type from the input type.
source§

impl From<&u8> for Value

source§

fn from(n: &u8) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> From<[u8; N]> for Value

source§

fn from(v: [u8; N]) -> Self

Converts to this type from the input type.
source§

impl From<BTreeMap<String, Value, Global>> for Value

source§

fn from(object: Object) -> Self

Converts to this type from the input type.
source§

impl From<BTreeMap<i32, Value, Global>> for Value

source§

fn from(map: Map) -> Self

Converts to this type from the input type.
source§

impl From<Cow<'_, str>> for Value

source§

fn from(s: Cow<'_, str>) -> Self

Converts to this type from the input type.
source§

impl<T> From<Option<T>> for Valuewhere T: Into<Value>,

source§

fn from(v: Option<T>) -> Self

Converts to this type from the input type.
source§

impl From<String> for Value

source§

fn from(s: String) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Value, Global>> for Value

source§

fn from(list: List) -> Self

Converts to this type from the input type.
source§

impl From<Vec<u8, Global>> for Value

source§

fn from(v: Blob) -> Self

Converts to this type from the input type.
source§

impl From<bool> for Value

source§

fn from(b: bool) -> Self

Converts to this type from the input type.
source§

impl From<f32> for Value

source§

fn from(n: f32) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Value

source§

fn from(n: f64) -> Self

Converts to this type from the input type.
source§

impl From<i16> for Value

source§

fn from(n: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Value

source§

fn from(n: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Value

source§

fn from(n: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Value

source§

fn from(n: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Value

source§

fn from(n: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Value

source§

fn from(n: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Value

source§

fn from(n: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Value

source§

fn from(n: u8) -> Self

Converts to this type from the input type.
source§

impl FromIterator<(String, Value)> for Value

source§

fn from_iter<T>(iter: T) -> Selfwhere T: IntoIterator<Item = (ObjectKey, Self)>,

Creates a value from an iterator. Read more
source§

impl FromIterator<(i32, Value)> for Value

source§

fn from_iter<T>(iter: T) -> Selfwhere T: IntoIterator<Item = (MapKey, Self)>,

Creates a value from an iterator. Read more
source§

impl FromIterator<Value> for Value

source§

fn from_iter<T>(iter: T) -> Selfwhere T: IntoIterator<Item = Self>,

Creates a value from an iterator. Read more
source§

impl PartialEq<Value> for Value

source§

fn eq(&self, other: &Value) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<&Value> for bool

§

type Error = Error

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Value> for f32

§

type Error = Error

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Value> for f64

§

type Error = Error

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Value> for i16

§

type Error = Error

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Value> for i32

§

type Error = Error

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Value> for i64

§

type Error = Error

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Value> for i8

§

type Error = Error

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Value> for u16

§

type Error = Error

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Value> for u32

§

type Error = Error

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Value> for u64

§

type Error = Error

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&Value> for u8

§

type Error = Error

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const N: usize> TryFrom<Value> for [u8; N]

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for Blob

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for List

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for Map

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for Object

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for String

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for bool

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for f32

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for f64

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for i16

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for i32

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for i64

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for i8

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for u16

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for u32

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for u64

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for u8

§

type Error = Error

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.