Skip to main content

Fixture

Struct Fixture 

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

A test fixture containing files and configuration.

Implementations§

Source§

impl Fixture

Source

pub fn new() -> Self

Create a new empty fixture.

Source

pub fn from_tar(data: &[u8]) -> Result<Self, FixtureError>

Create fixture from a tar archive (embedded bytes).

§Errors

Returns error if tar parsing fails.

Source

pub fn from_files(files: Vec<(&str, &[u8])>) -> Self

Create fixture from inline files.

Source

pub fn manifest(&self) -> &FixtureManifest

Get the fixture manifest.

Source

pub fn list_files(&self) -> Vec<&str>

List all file paths in the fixture.

Source

pub fn has_file(&self, path: &str) -> bool

Check if a file exists.

Source

pub fn get_file(&self, path: &str) -> Result<&[u8], FixtureError>

Get file contents as bytes.

Source

pub fn get_file_str(&self, path: &str) -> Result<&str, FixtureError>

Get file contents as string.

Source

pub fn get_app_yaml(&self) -> Result<&str, FixtureError>

Get the app.yaml content if present.

Source

pub fn get_data(&self, name: &str) -> Result<&[u8], FixtureError>

Get a data file (.ald) content.

Source

pub fn get_model(&self, name: &str) -> Result<&[u8], FixtureError>

Get a model file (.apr) content.

Source

pub fn get_snapshot(&self, name: &str) -> Result<&[u8], FixtureError>

Get a snapshot baseline image.

Source

pub fn add_file(&mut self, path: &str, content: Vec<u8>)

Add a file to the fixture.

Source

pub fn remove_file(&mut self, path: &str) -> Option<Vec<u8>>

Remove a file from the fixture.

Source

pub fn file_count(&self) -> usize

Get fixture file count.

Source

pub fn total_size(&self) -> usize

Get total fixture size in bytes.

Trait Implementations§

Source§

impl Clone for Fixture

Source§

fn clone(&self) -> Fixture

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 Fixture

Source§

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

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

impl Default for Fixture

Source§

fn default() -> Self

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

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, 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.