Skip to main content

VectorFile

Struct VectorFile 

Source
pub struct VectorFile {
    pub algorithm: String,
    pub source: String,
    pub cases: Vec<BTreeMap<String, String>>,
    pub path: PathBuf,
}
Expand description

A loaded vector file.

Fields§

§algorithm: String

What the file says it is for.

§source: String

Where the vectors came from, for the record.

§cases: Vec<BTreeMap<String, String>>

The cases, each a map of field name to raw hex string.

§path: PathBuf

Where the file was found.

Implementations§

Source§

impl VectorFile

Source

pub fn load(name: &str) -> Option<VectorFile>

Load testvectors/<name>.json, or None if it is not there.

A malformed file is an error rather than a miss: someone went to the trouble of providing it, and silently ignoring it would waste their effort in the most confusing way available.

Source

pub fn load_from(dir: &Path, name: &str) -> Option<VectorFile>

load, reading from a directory the caller names.

Exists so the tests can point at a directory of their own rather than setting IC_TEST_VECTORS – cargo runs a crate’s tests as threads in one process, so mutating the environment races every sibling that reads it.

Source

pub fn load_or_report(name: &str) -> Option<VectorFile>

Load, or print why nothing was checked and return None.

The message is the point. A skipped vector test should be visible in the output of cargo test -- --nocapture, not inferred from its absence.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.