Enum vector_core::event::Value

pub enum Value {
    Bytes(Bytes),
    Regex(ValueRegex),
    Integer(i64),
    Float(NotNan<f64>),
    Boolean(bool),
    Timestamp(DateTime<Utc>),
    Object(BTreeMap<KeyString, Value>),
    Array(Vec<Value>),
    Null,
}
Expand description

The main value type used in Vector events, and VRL.

Variants§

§

Bytes(Bytes)

Bytes - usually representing a UTF8 String.

§

Regex(ValueRegex)

Regex. When used in the context of Vector this is treated identically to Bytes. It has additional meaning in the context of VRL.

§

Integer(i64)

Integer.

§

Float(NotNan<f64>)

Float - not NaN.

§

Boolean(bool)

Boolean.

§

Timestamp(DateTime<Utc>)

Timestamp (UTC).

§

Object(BTreeMap<KeyString, Value>)

Object.

§

Array(Vec<Value>)

Array.

§

Null

Null.

Implementations§

§

impl Value

pub fn as_float(&self) -> Option<NotNan<f64>>

Returns self as NotNan<f64>, only if self is Value::Float.

pub fn into_object(self) -> Option<BTreeMap<KeyString, Value>>

Returns self as ObjectMap, only if self is Value::Object.

pub fn as_timestamp(&self) -> Option<&DateTime<Utc>>

Returns self as &DateTime<Utc>, only if self is Value::Timestamp.

pub fn as_timestamp_unwrap(&self) -> &DateTime<Utc>

Returns self as a DateTime<Utc>.

§Panics

This function will panic if self is anything other than Value::Timestamp.

pub fn as_object_mut_unwrap(&mut self) -> &mut BTreeMap<KeyString, Value>

Returns self as a mutable ObjectMap.

§Panics

This function will panic if self is anything other than Value::Object.

pub fn as_array_unwrap(&self) -> &[Value]

Returns self as a Vec<Value>.

§Panics

This function will panic if self is anything other than Value::Array.

pub fn as_array_mut_unwrap(&mut self) -> &mut Vec<Value>

Returns self as a mutable Vec<Value>.

§Panics

This function will panic if self is anything other than Value::Array.

pub fn is_integer(&self) -> bool

Returns true if self is Value::Integer.

pub fn as_integer(&self) -> Option<i64>

Returns self as f64, only if self is Value::Integer.

pub fn is_float(&self) -> bool

Returns true if self is Value::Float.

pub fn from_f64_or_zero(value: f64) -> Value

Creates a Value from an f64. If the value is Nan, it is converted to 0.0

§Panics

If NaN is used as a default value.

pub fn is_bytes(&self) -> bool

Returns true if self is Value::Bytes.

pub fn as_bytes(&self) -> Option<&Bytes>

Returns self as &Bytes, only if self is Value::Bytes.

pub fn as_str(&self) -> Option<Cow<'_, str>>

Returns self as Cow<str>, only if self is Value::Bytes

pub fn encode_as_bytes(&self) -> Result<Bytes, String>

Converts the Value into a byte representation regardless of its original type. Object and Array are currently not supported, although technically there’s no reason why it couldn’t in future should the need arise.

§Errors

If the type is Object or Array, and string error description will be returned

pub fn is_boolean(&self) -> bool

Returns true if self is Value::Boolean.

pub fn as_boolean(&self) -> Option<bool>

Returns self as bool, only if self is Value::Boolean.

pub fn is_regex(&self) -> bool

Returns true if self is Value::Regex.

pub fn as_regex(&self) -> Option<&Regex>

Returns self as &ValueRegex, only if self is Value::Regex.

pub fn is_null(&self) -> bool

Returns true if self is Value::Null.

pub fn as_null(&self) -> Option<()>

Returns self as ()), only if self is Value::Null.

pub fn is_array(&self) -> bool

Returns true if self is Value::Array.

pub fn as_array(&self) -> Option<&[Value]>

Returns self as &[Value], only if self is Value::Array.

pub fn as_array_mut(&mut self) -> Option<&mut Vec<Value>>

Returns self as &mut Vec<Value>, only if self is Value::Array.

pub fn is_object(&self) -> bool

Returns true if self is Value::Object.

pub fn as_object(&self) -> Option<&BTreeMap<KeyString, Value>>

Returns self as &ObjectMap, only if self is Value::Object.

pub fn as_object_mut(&mut self) -> Option<&mut BTreeMap<KeyString, Value>>

Returns self as &mut ObjectMap, only if self is Value::Object.

pub fn is_timestamp(&self) -> bool

Returns true if self is Value::Timestamp.

pub fn kind(&self) -> Kind

Returns the Kind of this Value

§

impl Value

pub fn into_iter<'a>(self, recursive: bool) -> ValueIter<'a>

Create an iterator over the Value.

For non-collection types, this returns a single-item iterator similar to Option’s iterator implementation.

For collection types, it returns all elements in the collection.

The resulting item is an [IterItem], which contains either a mutable Value for non-collection types, a (&mut KeyString, &mut Value) pair for object-type collections, or an immutable/mutable (usize, &mut Value) pair for array-type collections.

§Recursion

If recursion is set to true, the iterator recurses into nested collection types.

Recursion follows these rules:

  • When a collection type is found, that type is first returned as-is. That is, if we’re iterating over an object, and within that object is a field “foo” containing an array, then we first return IterItem::KeyValue, which contains the key “foo”, and the array as the value.
  • After returning the collection type, the iterator recurses into the nested collection itself. Using the previous example, we now go into the array, and start returning IterItem::IndexValue variants for the elements within the array.
  • Any mutations done to the array before recursing into it are preserved, meaning once recursion starts, the mutations done on the object itself are preserved.
§

impl Value

pub fn at_path<'a>(self, path: impl ValuePath<'a>) -> Value

Insert the current value into a given path.

For example, given the path .foo.bar and value true, the return value would be an object representing { "foo": { "bar": true } }.

§

impl Value

pub fn coerce_to_bytes(&self) -> Bytes

Converts self into a Bytes, using JSON for Map/Array.

§Panics

If map or array serialization fails.

pub fn to_string_lossy(&self) -> Cow<'_, str>

Converts self into a String representation, using JSON for Map/Array.

§Panics

If map or array serialization fails.

§

impl Value

pub const fn kind_str(&self) -> &str

Returns a string description of the value type

pub fn merge(&mut self, incoming: Value)

Merges incoming value into self.

Will concatenate Bytes and overwrite the rest value kinds.

pub fn is_empty(&self) -> bool

Return if the node is empty, that is, it is an array or map with no items.

use vrl::value::Value;
use std::collections::BTreeMap;
use vrl::path;

let val = Value::from(1);
assert_eq!(val.is_empty(), false);

let mut val = Value::from(Vec::<Value>::default());
assert_eq!(val.is_empty(), true);
val.insert(path!(0), 1);
assert_eq!(val.is_empty(), false);
val.insert(path!(3), 1);
assert_eq!(val.is_empty(), false);

let mut val = Value::from(BTreeMap::default());
assert_eq!(val.is_empty(), true);
val.insert(path!("foo"), 1);
assert_eq!(val.is_empty(), false);
val.insert(path!("bar"), 2);
assert_eq!(val.is_empty(), false);

pub fn insert<'a>( &mut self, path: impl ValuePath<'a>, insert_value: impl Into<Value>, ) -> Option<Value>

Returns a reference to a field value specified by a path iter.

pub fn remove<'a>( &mut self, path: impl ValuePath<'a>, prune: bool, ) -> Option<Value>

Removes field value specified by the given path and return its value.

A special case worth mentioning: if there is a nested array and an item is removed from the middle of this array, then it is just replaced by Value::Null.

pub fn get<'a>(&self, path: impl ValuePath<'a>) -> Option<&Value>

Returns a reference to a field value specified by a path iter.

pub fn get_mut<'a>(&mut self, path: impl ValuePath<'a>) -> Option<&mut Value>

Get a mutable borrow of the value by path

pub fn contains<'a>(&self, path: impl ValuePath<'a>) -> bool

Determine if the lookup is contained within the value.

Trait Implementations§

§

impl Arbitrary for Value

§

fn arbitrary(g: &mut Gen) -> Value

Return an arbitrary value. Read more
§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
§

impl ByteSizeOf for Value

§

fn allocated_bytes(&self) -> usize

Returns the allocated bytes of this type Read more
§

fn size_of(&self) -> usize

Returns the in-memory size of this type Read more
§

impl Clone for Value

§

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
§

impl Debug for Value

§

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

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for Value

§

fn deserialize<D>( deserializer: D, ) -> Result<Value, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Display for Value

§

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

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

impl EstimatedJsonEncodedSizeOf for Value

§

impl From<&[u8]> for Value

§

fn from(data: &[u8]) -> Value

Converts to this type from the input type.
§

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

§

fn from(data: &[u8; N]) -> Value

Converts to this type from the input type.
§

impl From<&Value> for Kind

§

fn from(value: &Value) -> Kind

Converts to this type from the input type.
§

impl From<&Value> for Value

§

fn from(json_value: &Value) -> Value

Converts to this type from the input type.
§

impl From<&str> for Value

§

fn from(v: &str) -> Value

Converts to this type from the input type.
§

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

§

fn from(data: [u8; N]) -> Value

Converts to this type from the input type.
§

impl From<()> for Value

§

fn from(_: ()) -> Value

Converts to this type from the input type.
§

impl From<Arc<Regex>> for Value

§

fn from(r: Arc<Regex>) -> Value

Converts to this type from the input type.
§

impl From<BTreeMap<KeyString, Value>> for Value

§

fn from(value: BTreeMap<KeyString, Value>) -> Value

Converts to this type from the input type.
§

impl From<Bytes> for Value

§

fn from(bytes: Bytes) -> Value

Converts to this type from the input type.
§

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

§

fn from(v: Cow<'_, str>) -> Value

Converts to this type from the input type.
§

impl From<DateTime<Utc>> for Value

§

fn from(timestamp: DateTime<Utc>) -> Value

Converts to this type from the input type.
§

impl From<IterData> for Value

§

fn from(iter: IterData) -> Value

Converts to this type from the input type.
§

impl From<KeyString> for Value

§

fn from(string: KeyString) -> Value

Converts to this type from the input type.
source§

impl From<MetricKind> for Value

source§

fn from(kind: MetricKind) -> Self

Converts to this type from the input type.
source§

impl From<MetricSketch> for Value

source§

fn from(value: MetricSketch) -> Self

Converts to this type from the input type.
source§

impl From<MetricValue> for Value

source§

fn from(value: MetricValue) -> Self

Converts to this type from the input type.
§

impl From<NotNan<f32>> for Value

§

fn from(value: NotNan<f32>) -> Value

Converts to this type from the input type.
§

impl From<NotNan<f64>> for Value

§

fn from(value: NotNan<f64>) -> Value

Converts to this type from the input type.
§

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

§

fn from(value: Option<T>) -> Value

Converts to this type from the input type.
§

impl From<Regex> for Value

§

fn from(r: Regex) -> Value

Converts to this type from the input type.
§

impl From<String> for Value

§

fn from(string: String) -> Value

Converts to this type from the input type.
§

impl From<Value> for Kind

§

fn from(value: Value) -> Kind

Converts to this type from the input type.
source§

impl From<Value> for LogEvent

source§

fn from(value: Value) -> Self

Converts to this type from the input type.
§

impl From<Value> for Value

§

fn from(json_value: Value) -> Value

Converts to this type from the input type.
§

impl<'a> From<ValueIter<'a>> for Value

§

fn from(iter: ValueIter<'a>) -> Value

Converts to this type from the input type.
§

impl From<ValueRegex> for Value

§

fn from(r: ValueRegex) -> Value

Converts to this type from the input type.
§

impl<T> From<Vec<T>> for Value
where T: Into<Value>,

§

fn from(set: Vec<T>) -> Value

Converts to this type from the input type.
§

impl From<bool> for Value

§

fn from(value: bool) -> Value

Converts to this type from the input type.
§

impl From<f64> for Value

§

fn from(f: f64) -> Value

Converts to this type from the input type.
§

impl From<i16> for Value

§

fn from(value: i16) -> Value

Converts to this type from the input type.
§

impl From<i32> for Value

§

fn from(value: i32) -> Value

Converts to this type from the input type.
§

impl From<i64> for Value

§

fn from(value: i64) -> Value

Converts to this type from the input type.
§

impl From<i8> for Value

§

fn from(value: i8) -> Value

Converts to this type from the input type.
§

impl From<isize> for Value

§

fn from(value: isize) -> Value

Converts to this type from the input type.
§

impl From<u16> for Value

§

fn from(value: u16) -> Value

Converts to this type from the input type.
§

impl From<u32> for Value

§

fn from(value: u32) -> Value

Converts to this type from the input type.
§

impl From<u64> for Value

§

fn from(value: u64) -> Value

Converts to this type from the input type.
§

impl From<u8> for Value

§

fn from(value: u8) -> Value

Converts to this type from the input type.
§

impl From<usize> for Value

§

fn from(value: usize) -> Value

Converts to this type from the input type.
§

impl FromIterator<(KeyString, Value)> for Value

§

fn from_iter<I>(iter: I) -> Value
where I: IntoIterator<Item = (KeyString, Value)>,

Creates a value from an iterator. Read more
§

impl FromIterator<(String, Value)> for Value

§

fn from_iter<I>(iter: I) -> Value
where I: IntoIterator<Item = (String, Value)>,

Creates a value from an iterator. Read more
§

impl FromIterator<Value> for Value

§

fn from_iter<I>(iter: I) -> Value
where I: IntoIterator<Item = Value>,

Creates a value from an iterator. Read more
§

impl<'a> FromLua<'a> for Value

§

fn from_lua(value: Value<'a>, lua: &'a Lua) -> Result<Value, Error>

Performs the conversion.
§

impl Hash for Value

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<'a> IntoLua<'a> for Value

§

fn into_lua(self, lua: &'a Lua) -> Result<Value<'a>, Error>

Performs the conversion.
§

impl PartialEq for Value

§

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.
§

impl SecretTarget for Value

§

fn get_secret(&self, _key: &str) -> Option<&str>

§

fn insert_secret(&mut self, _key: &str, _value: &str)

§

fn remove_secret(&mut self, _key: &str)

§

impl Serialize for Value

§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl Target for Value

§

fn target_insert( &mut self, target_path: &OwnedTargetPath, value: Value, ) -> Result<(), String>

Insert a given Value in the provided [Target]. Read more
§

fn target_get( &self, target_path: &OwnedTargetPath, ) -> Result<Option<&Value>, String>

Get a value for a given path, or None if no value is found. Read more
§

fn target_get_mut( &mut self, target_path: &OwnedTargetPath, ) -> Result<Option<&mut Value>, String>

Get a mutable reference to the value for a given path, or None if no value is found. Read more
§

fn target_remove( &mut self, target_path: &OwnedTargetPath, compact: bool, ) -> Result<Option<Value>, String>

Remove the given path from the object. Read more
§

impl TryFrom<Expr> for Value

Converts from an Expr into a Value. This is only possible if the expression represents static values - Literals and Containers containing Literals. The error returns the expression back so it can be used in the error report.

§

type Error = Expr

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

fn try_from(expr: Expr) -> Result<Value, <Value as TryFrom<Expr>>::Error>

Performs the conversion.
source§

impl TryFrom<Value> for MetricKind

§

type Error = String

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

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

Performs the conversion.
§

impl TryInto<Value> for Value

§

type Error = Box<dyn Error + Sync + Send>

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

fn try_into(self) -> Result<Value, <Value as TryInto<Value>>::Error>

Performs the conversion.
§

impl VrlValueArithmetic for Value

§

fn try_mul(self, rhs: Value) -> Result<Value, ValueError>

Similar to std::ops::Mul, but fallible (e.g. TryMul).

§

fn try_div(self, rhs: Value) -> Result<Value, ValueError>

Similar to std::ops::Div, but fallible (e.g. TryDiv).

§

fn try_add(self, rhs: Value) -> Result<Value, ValueError>

Similar to std::ops::Add, but fallible (e.g. TryAdd).

§

fn try_sub(self, rhs: Value) -> Result<Value, ValueError>

Similar to std::ops::Sub, but fallible (e.g. TrySub).

§

fn try_or( self, rhs: impl FnMut() -> Result<Value, ExpressionError>, ) -> Result<Value, ValueError>

Try to “OR” (||) two values types.

If the lhs value is null or false, the rhs is evaluated and returned. The rhs is a closure that can return an error, and thus this method can return an error as well.

§

fn try_and(self, rhs: Value) -> Result<Value, ValueError>

Try to “AND” (&&) two values types.

A lhs or rhs value of Null returns false.

§

fn try_rem(self, rhs: Value) -> Result<Value, ValueError>

Similar to std::ops::Rem, but fallible (e.g. TryRem).

§

fn try_gt(self, rhs: Value) -> Result<Value, ValueError>

Similar to std::cmp::Ord, but fallible (e.g. TryOrd).

§

fn try_ge(self, rhs: Value) -> Result<Value, ValueError>

Similar to std::cmp::Ord, but fallible (e.g. TryOrd).

§

fn try_lt(self, rhs: Value) -> Result<Value, ValueError>

Similar to std::cmp::Ord, but fallible (e.g. TryOrd).

§

fn try_le(self, rhs: Value) -> Result<Value, ValueError>

Similar to std::cmp::Ord, but fallible (e.g. TryOrd).

§

fn eq_lossy(&self, rhs: &Value) -> bool

Similar to std::cmp::Eq, but does a lossless comparison for integers and floats.

§

fn try_merge(self, rhs: Value) -> Result<Value, ValueError>

§

impl VrlValueConvert for Value

§

fn into_expression(self) -> Box<dyn Expression>

Convert a given Value into a [Expression] trait object.

§

fn try_integer(self) -> Result<i64, ValueError>

§

fn try_into_i64(&self) -> Result<i64, ValueError>

§

fn try_float(self) -> Result<f64, ValueError>

§

fn try_into_f64(&self) -> Result<f64, ValueError>

§

fn try_bytes(self) -> Result<Bytes, ValueError>

§

fn try_bytes_utf8_lossy(&self) -> Result<Cow<'_, str>, ValueError>

§

fn try_boolean(self) -> Result<bool, ValueError>

§

fn try_regex(self) -> Result<ValueRegex, ValueError>

§

fn try_null(self) -> Result<(), ValueError>

§

fn try_array(self) -> Result<Vec<Value>, ValueError>

§

fn try_object(self) -> Result<BTreeMap<KeyString, Value>, ValueError>

§

fn try_timestamp(self) -> Result<DateTime<Utc>, ValueError>

§

impl Eq for Value

§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl !Freeze for Value

§

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 T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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
§

impl<T> CallHasher for T
where T: Hash + ?Sized,

§

fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<'lua, T> FromLuaMulti<'lua> for T
where T: FromLua<'lua>,

§

fn from_lua_multi(values: MultiValue<'lua>, lua: &'lua Lua) -> Result<T, Error>

Performs the conversion. Read more
§

fn from_lua_args( args: MultiValue<'lua>, i: usize, to: Option<&str>, lua: &'lua Lua, ) -> Result<T, Error>

§

unsafe fn from_stack_multi(nvals: i32, lua: &'lua Lua) -> Result<T, Error>

§

unsafe fn from_stack_args( nargs: i32, i: usize, to: Option<&str>, lua: &'lua Lua, ) -> Result<T, Error>

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<'lua, T> IntoLuaMulti<'lua> for T
where T: IntoLua<'lua>,

§

fn into_lua_multi(self, lua: &'lua Lua) -> Result<MultiValue<'lua>, Error>

Performs the conversion.
§

unsafe fn push_into_stack_multi(self, lua: &'lua Lua) -> Result<i32, Error>

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

§

type Error = <Target as OctetsFrom<Source>>::Error

§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
§

fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>

Change the foreground color to black
§

fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>

Change the background color to black
§

fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>

Change the foreground color to red
§

fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>

Change the background color to red
§

fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>

Change the foreground color to green
§

fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>

Change the background color to green
§

fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>

Change the background color to yellow
§

fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>

Change the foreground color to blue
§

fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>

Change the background color to blue
§

fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>

Change the background color to magenta
§

fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>

Change the foreground color to purple
§

fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>

Change the background color to purple
§

fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>

Change the background color to cyan
§

fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>

Change the foreground color to white
§

fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>

Change the background color to white
§

fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>

Change the background color to the terminal default
§

fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>

Change the background color to bright red
§

fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>

Change the background color to bright white
§

fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>

Make the text bold
§

fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>

Make the text dim
§

fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>

Make the text italicized
§

fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>

Make the text italicized
Make the text blink
Make the text blink (but fast!)
§

fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>

Swap the foreground and background colors
§

fn hidden<'a>(&'a self) -> HiddenDisplay<'a, Self>

Hide the text
§

fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where 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> ToString for T
where T: Display + ?Sized,

source§

default 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>,

§

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>,

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,