[]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

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

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

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

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

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>

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>

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

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

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

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

Provides a reference to the binary argument vector.

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

Provides a mutable reference to the binary argument vector.

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

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

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

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

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

Provides a reference to the binary argument vector.

pub fn clear_cbor(&mut self)

Resets the CBOR to an empty object.

pub fn clear_args(&mut self)

Clears the binary arguments vector.

pub fn clear(&mut self)

Clears the CBOR object and binary arguments vector.

pub fn copy_from(&mut self, src: &ArbData)

Copies the data from another ArbData to this one.

Trait Implementations

impl Clone for ArbData

impl Debug for ArbData

impl Default for ArbData

fn default() -> Self

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

impl<'de> Deserialize<'de> for ArbData

impl Display for ArbData

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

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

impl Eq for ArbData

impl FromStr for ArbData

type Err = Error

The associated error which can be returned from parsing.

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

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 Hash for ArbData

impl Into<ArbData> for ArbCmd

impl PartialEq<ArbData> for ArbData

impl Serialize for ArbData

impl StructuralPartialEq for ArbData

Auto Trait Implementations

impl RefUnwindSafe for ArbData

impl Send for ArbData

impl Sync for ArbData

impl Unpin for ArbData

impl UnwindSafe for ArbData

Blanket Implementations

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

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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<V, T> VZip<V> for T where
    V: MultiLane<T>,