Struct MetadataValue

Source
pub struct MetadataValue { /* private fields */ }
Expand description

Represents a [JobCall] metadata field value.

To handle this, the MetadataValue is usable as a type and can be compared with strings and implements Debug. A to_str method is provided that returns an Err if the metadata value contains non-visible ASCII characters.

Implementations§

Source§

impl MetadataValue

Source

pub fn from_bytes(value: Bytes) -> Self

Create a new MetadataValue from a string.

Source

pub fn from_sensitive_str(value: &str) -> Self

Create a new MetadataValue from a string.

Source

pub fn from_sensitive_bytes(value: Bytes) -> Self

Create a new MetadataValue from a string.

Source

pub fn is_sensitive(&self) -> bool

Returns true if the metadata value is sensitive.

Source

pub fn len(&self) -> usize

Returns the length of the metadata value.

Source

pub fn is_empty(&self) -> bool

Returns true if the metadata value is empty.

Source

pub fn to_str(&self) -> Result<&str, Utf8Error>

Converts the metadata value into a string if it contains valid UTF-8.

Source

pub fn into_bytes(self) -> Bytes

Converts the metadata value into bytes.

Source

pub fn as_bytes(&self) -> &[u8]

Trait Implementations§

Source§

impl AsRef<[u8]> for MetadataValue

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for MetadataValue

Source§

fn clone(&self) -> MetadataValue

Returns a duplicate 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 MetadataValue

Source§

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

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

impl Default for MetadataValue

Source§

fn default() -> MetadataValue

Returns the “default value” for a type. Read more
Source§

impl From<&[u8]> for MetadataValue

Source§

fn from(value: &[u8]) -> Self

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl From<&Bytes> for MetadataValue

Source§

fn from(value: &Bytes) -> Self

Converts to this type from the input type.
Source§

impl From<&BytesMut> for MetadataValue

Source§

fn from(value: &BytesMut) -> Self

Converts to this type from the input type.
Source§

impl From<&String> for MetadataValue

Source§

fn from(value: &String) -> Self

Converts to this type from the input type.
Source§

impl From<&Vec<u8>> for MetadataValue

Source§

fn from(value: &Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<&i128> for MetadataValue

Source§

fn from(value: &i128) -> Self

Converts to this type from the input type.
Source§

impl From<&i16> for MetadataValue

Source§

fn from(value: &i16) -> Self

Converts to this type from the input type.
Source§

impl From<&i32> for MetadataValue

Source§

fn from(value: &i32) -> Self

Converts to this type from the input type.
Source§

impl From<&i64> for MetadataValue

Source§

fn from(value: &i64) -> Self

Converts to this type from the input type.
Source§

impl From<&isize> for MetadataValue

Source§

fn from(value: &isize) -> Self

Converts to this type from the input type.
Source§

impl From<&str> for MetadataValue

Source§

fn from(value: &str) -> Self

Converts to this type from the input type.
Source§

impl From<&u128> for MetadataValue

Source§

fn from(value: &u128) -> Self

Converts to this type from the input type.
Source§

impl From<&u16> for MetadataValue

Source§

fn from(value: &u16) -> Self

Converts to this type from the input type.
Source§

impl From<&u32> for MetadataValue

Source§

fn from(value: &u32) -> Self

Converts to this type from the input type.
Source§

impl From<&u64> for MetadataValue

Source§

fn from(value: &u64) -> Self

Converts to this type from the input type.
Source§

impl From<&usize> for MetadataValue

Source§

fn from(value: &usize) -> Self

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl From<Bytes> for MetadataValue

Source§

fn from(value: Bytes) -> Self

Converts to this type from the input type.
Source§

impl From<BytesMut> for MetadataValue

Source§

fn from(value: BytesMut) -> Self

Converts to this type from the input type.
Source§

impl From<String> for MetadataValue

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for MetadataValue

Source§

fn from(value: Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for MetadataValue

Converts a number into a metadata value by converting it to a big-endian byte array.

Source§

fn from(value: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for MetadataValue

Converts a number into a metadata value by converting it to a big-endian byte array.

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for MetadataValue

Converts a number into a metadata value by converting it to a big-endian byte array.

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for MetadataValue

Converts a number into a metadata value by converting it to a big-endian byte array.

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for MetadataValue

Converts a number into a metadata value by converting it to a big-endian byte array.

Source§

fn from(value: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for MetadataValue

Converts a number into a metadata value by converting it to a big-endian byte array.

Source§

fn from(value: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for MetadataValue

Converts a number into a metadata value by converting it to a big-endian byte array.

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for MetadataValue

Converts a number into a metadata value by converting it to a big-endian byte array.

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for MetadataValue

Converts a number into a metadata value by converting it to a big-endian byte array.

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for MetadataValue

Converts a number into a metadata value by converting it to a big-endian byte array.

Source§

fn from(value: usize) -> Self

Converts to this type from the input type.
Source§

impl FromStr for MetadataValue

Source§

type Err = Infallible

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl TryFrom<&MetadataValue> for i128

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<&MetadataValue> for i16

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<&MetadataValue> for i32

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<&MetadataValue> for i64

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<&MetadataValue> for isize

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<&MetadataValue> for u128

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<&MetadataValue> for u16

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<&MetadataValue> for u32

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<&MetadataValue> for u64

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<&MetadataValue> for usize

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<MetadataValue> for i128

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<MetadataValue> for i16

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<MetadataValue> for i32

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<MetadataValue> for i64

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<MetadataValue> for isize

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<MetadataValue> for u128

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<MetadataValue> for u16

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<MetadataValue> for u32

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<MetadataValue> for u64

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl TryFrom<MetadataValue> for usize

Tries to convert a metadata value into a number by parsing it as a big-endian byte array.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

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

impl<T> Instrument for T

Source§

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

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

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.

Source§

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

Source§

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

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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