[][src]Struct dqcsim::common::types::ArbData

pub struct ArbData { /* fields omitted */ }

Represents an ArbData structure, consisting of an (unparsed, TODO) JSON string and a list of binary strings.

Methods

impl ArbData[src]

pub fn from_str_args_only(s: &str) -> Result<Self>[src]

Constructs an ArgData from a string containing only one or more unstructured binary arguments, using {} for the JSON object.

The unstructured binary strings are separated by commas. Furthermore, the following escape sequences are recognized:

  • _, turns into a comma (,).
  • __ turns into an underscore (_).
  • _## where ## is a 2-digit hexadecimal string turns into a byte with the respective value.

To also parse a JSON object, use from_str(). To get an ArbData with the default JSON object and zero binary arguments, use default().

pub fn from_args(args: impl Into<Vec<Vec<u8>>>) -> Self[src]

Construct an ArbData with just binary arguments and {} for the JSON/CBOR object.

pub fn from_cbor_unchecked(
    cbor: impl Into<Vec<u8>>,
    args: impl Into<Vec<Vec<u8>>>
) -> Self
[src]

Construct an ArbData from a CBOR object and binary arguments, without ensuring that the CBOR object is valid.

pub fn from_cbor(
    cbor: impl AsRef<[u8]>,
    args: impl Into<Vec<Vec<u8>>>
) -> Result<Self>
[src]

Construct an ArbData from a CBOR object and binary arguments, while ensuring that the CBOR object is valid.

pub fn from_json(
    json: impl AsRef<str>,
    args: impl Into<Vec<Vec<u8>>>
) -> Result<Self>
[src]

Construct an ArbData from a JSON object and binary arguments, while ensuring that the JSON object is valid.

pub fn get_json(&self) -> Result<String>[src]

Returns the JSON/CBOR data field as a JSON string.

pub fn get_cbor(&self) -> &[u8][src]

Returns the JSON/CBOR data field as a CBOR string.

pub fn get_args(&self) -> &[Vec<u8>][src]

Provides a reference to the binary argument vector.

pub fn get_args_mut(&mut self) -> &mut Vec<Vec<u8>>[src]

Provides a mutable reference to the binary argument vector.

pub fn set_json(&mut self, json: impl AsRef<str>) -> Result<()>[src]

Sets the JSON/CBOR data field by means of a JSON string.

pub fn set_cbor(&mut self, cbor: impl AsRef<[u8]>) -> Result<()>[src]

Sets the JSON/CBOR data field by means of a CBOR string.

pub fn set_cbor_unchecked(&mut self, cbor: impl Into<Vec<u8>>)[src]

Sets the JSON/CBOR data field by means of a CBOR string without ensuring that the CBOR is valid.

pub fn set_args(&mut self, args: impl Into<Vec<Vec<u8>>>)[src]

Provides a reference to the binary argument vector.

Trait Implementations

impl PartialEq<ArbData> for ArbData[src]

impl Default for ArbData[src]

fn default() -> Self[src]

Constructs an ArbData with JSON object {} and zero unstructured binary arguments.

impl Into<ArbData> for ArbCmd[src]

impl Clone for ArbData[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for ArbData[src]

impl Display for ArbData[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

Turns the ArbData object into a string representation that can be parsed by from_str().

impl FromStr for ArbData[src]

type Err = Error

The associated error which can be returned from parsing.

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

Constructs an ArgData from its string representation.

The string starts with a JSON object. The object is followed by zero or more unstructured binary strings, which are separated by commas. The following escape sequences are recognized in the binary strings:

  • _, turns into a comma (,).
  • __ turns into an underscore (_).
  • _## where ## is a 2-digit hexadecimal string turns into a byte with the respective value.

To omit the JSON object and substitute the default {}, use from_str_args_only(). To get an ArbData with the default JSON object and zero binary arguments, use default().

impl Serialize for ArbData[src]

impl<'de> Deserialize<'de> for ArbData[src]

Auto Trait Implementations

impl Send for ArbData

impl Unpin for ArbData

impl Sync for ArbData

impl UnwindSafe for ArbData

impl RefUnwindSafe for ArbData

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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

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