Struct Hex

Source
pub struct Hex<T>(pub T);
Expand description

Represent inner type as hex in JSON.

Hex<Vec<u8>>, Hex<&[u8]>, and Hex<[u8; SIZE]> store binary data. This wrapper does not support other inner types.

Tuple Fields§

§0: T

Trait Implementations§

Source§

impl AsRef<[u8]> for Hex<Vec<u8>>
where <Hex<Vec<u8>> as Deref>::Target: AsRef<[u8]>,

Source§

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

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

impl<T: Clone> Clone for Hex<T>

Source§

fn clone(&self) -> Hex<T>

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<T: Debug> Debug for Hex<T>

Source§

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

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

impl<T> Default for Hex<T>
where T: Default + ToHex,

Source§

fn default() -> Self

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

impl<T> Deref for Hex<T>
where T: ToHex,

Source§

type Target = T

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<'de, T> Deserialize<'de> for Hex<T>
where T: FromHex,

Source§

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

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

impl<T> Display for Hex<T>
where T: ToHex,

Source§

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

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

impl<'a, const SIZE: usize> From<&'a [u8; SIZE]> for Hex<&'a [u8]>

Source§

fn from(inner: &'a [u8; SIZE]) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Hex<Vec<u8>>

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl<T> From<T> for Hex<T>
where T: ToHex,

Source§

fn from(inner: T) -> Self

Converts to this type from the input type.
Source§

impl<T> FromStr for Hex<T>
where T: FromHex,

Source§

type Err = &'static str

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<T: Hash> Hash for Hex<T>

Source§

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

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

impl<T> InputType for Hex<T>
where T: FromHex + Send + Sync,

Source§

type RawValueType = Hex<T>

The raw type used for validator. Read more
Source§

fn type_name() -> Cow<'static, str>

Type the name.
Source§

fn create_type_info(registry: &mut Registry) -> String

Create type information in the registry and return qualified typename.
Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Parse from Value. None represents undefined.
Source§

fn to_value(&self) -> Value

Convert to a Value for introspection.
Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Returns a reference to the raw value.
Source§

fn qualified_type_name() -> String

Qualified typename.
Source§

impl<T: Ord> Ord for Hex<T>

Source§

fn cmp(&self, other: &Hex<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T> OutputType for Hex<T>
where T: FromHex + Send + Sync,

Source§

fn type_name() -> Cow<'static, str>

Type the name.
Source§

fn create_type_info(registry: &mut Registry) -> String

Create type information in the registry and return qualified typename.
Source§

async fn resolve( &self, _: &ContextSelectionSet<'_>, _field: &Positioned<Field>, ) -> ServerResult<Value>

Resolve an output value to async_graphql::Value.
Source§

fn qualified_type_name() -> String

Qualified typename.
Source§

fn introspection_type_name(&self) -> Cow<'static, str>

Introspection type name Read more
Source§

impl<T> Pack for Hex<T>
where T: ToHex + Pack,

Source§

fn pack(&self, dest: &mut Vec<u8>)

Convert to fracpack format Read more
Source§

fn packed(&self) -> Vec<u8>

Convert to fracpack format Read more
Source§

impl<T: PartialEq> PartialEq for Hex<T>

Source§

fn eq(&self, other: &Hex<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd> PartialOrd for Hex<T>

Source§

fn partial_cmp(&self, other: &Hex<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T> ScalarType for Hex<T>
where T: FromHex + Send + Sync,

Source§

fn parse(value: Value) -> InputValueResult<Self>

Parse a scalar value.
Source§

fn to_value(&self) -> Value

Convert the scalar to Value.
Source§

fn is_valid(_value: &ConstValue) -> bool

Checks for a valid scalar value. Read more
Source§

impl<T> Serialize for Hex<T>
where T: ToHex,

Source§

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

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

impl<T> ToKey for Hex<T>
where T: ToHex + Pack,

Source§

fn append_key(&self, key: &mut Vec<u8>)

Append to key
Source§

fn to_key(&self) -> Vec<u8>

Convert to key
Source§

fn append_option_key(obj: &Option<&Self>, key: &mut Vec<u8>)

Append to key
Source§

impl<T: ToSchema + 'static> ToSchema for Hex<T>

Source§

fn schema(builder: &mut SchemaBuilder) -> AnyType

Source§

impl<'a, T> Unpack<'a> for Hex<T>
where T: ToHex + Unpack<'a>,

Source§

fn unpack(src: &'a [u8], pos: &mut u32) -> Result<Self>

Convert from fracpack format. Also verifies the integrity of the data. Read more
Source§

fn verify(src: &'a [u8], pos: &mut u32) -> Result<()>

Verify the integrity of fracpack data. You don’t need to call this if using [Pack::unpack] since it verifies integrity during unpack.
Source§

fn unpacked(src: &'a [u8]) -> Result<Self, Error>

Convert from fracpack format. Also verifies the integrity of the data. Read more
Source§

fn verify_no_extra(src: &'a [u8]) -> Result<(), Error>

Verify the integrity of fracpack data, plus make sure there is no leftover data after it.
Source§

impl<T: Eq> Eq for Hex<T>

Source§

impl<T> StructuralPartialEq for Hex<T>

Auto Trait Implementations§

§

impl<T> Freeze for Hex<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Hex<T>
where T: RefUnwindSafe,

§

impl<T> Send for Hex<T>
where T: Send,

§

impl<T> Sync for Hex<T>
where T: Sync,

§

impl<T> Unpin for Hex<T>
where T: Unpin,

§

impl<T> UnwindSafe for Hex<T>
where T: UnwindSafe,

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

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

Source§

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

Checks if this value is equivalent to the given key. Read more
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.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<Reference, Outer, OuterFieldType, Inner> HasPart<Nested<Outer, Inner>> for Reference
where Reference: HasPart<Outer> + ?Sized, Outer: Part<PartType = Field<OuterFieldType>>, Inner: Part, OuterFieldType: HasPart<Inner, RawTarget = OuterFieldType> + PartialRefTarget + ?Sized,

Source§

unsafe fn part_ptr( ptr: *const <Reference as PartialRefTarget>::RawTarget, ) -> <<Inner as Part>::PartType as PartType>::Ptr

Given a constant pointer to a target, produce a constant pointer to a part of it. Read more
Source§

unsafe fn part_ptr_mut( ptr: *mut <Reference as PartialRefTarget>::RawTarget, ) -> <<Inner as Part>::PartType as PartType>::PtrMut

Given a mutable pointer to a target, produce a mutable pointer to a part of it. Read more
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<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> ToHex for T
where T: AsRef<[u8]>,

Source§

fn write_hex<W>(&self, w: &mut W) -> Result<(), Error>
where W: Write,

Writes the hex string representing self into w. Lower case letters are used (e.g. f9b4ca).
Source§

fn write_hex_upper<W>(&self, w: &mut W) -> Result<(), Error>
where W: Write,

Writes the hex string representing self into w. Upper case letters are used (e.g. F9B4CA).
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> 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.
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
Source§

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

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> UnpackOwned for T
where T: for<'a> Unpack<'a>,