multipart::server::save

Struct Entries

Source
pub struct Entries {
    pub fields: HashMap<Arc<str>, Vec<SavedField>>,
    pub save_dir: SaveDir,
    /* private fields */
}
Expand description

A result of Multipart::save().

Fields§

§fields: HashMap<Arc<str>, Vec<SavedField>>

The fields of the multipart request, mapped by field name -> value.

A field name may have multiple actual fields associated with it, but the most common case is a single field.

Each vector is guaranteed not to be empty unless externally modified.

§save_dir: SaveDir

The directory that the entries in fields were saved into.

Implementations§

Source§

impl Entries

Source

pub fn new(save_dir: SaveDir) -> Self

Create a new Entries with the given SaveDir

Source

pub fn is_empty(&self) -> bool

Returns true if fields is empty, false otherwise.

Source

pub fn fields_count(&self) -> u32

The number of actual fields contained within this Entries.

Effectively self.fields.values().map(Vec::len).sum() but maintained separately.

§Note

This will be incorrect if fields is modified externally. Call recount_fields() to get the correct count.

Source

pub fn recount_fields(&mut self) -> u32

Sum the number of fields in this Entries and then return the updated value.

Source

pub fn print_debug(&self) -> Result<()>

Print all fields and their contents to stdout. Mostly for testing purposes.

Source

pub fn write_debug<W: Write>(&self, writer: W) -> Result<()>

Write all fields and their contents to the given output. Mostly for testing purposes.

Trait Implementations§

Source§

impl Debug for Entries

Source§

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

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

impl<M: ReadEntry> Into<Entries> for PartialEntries<M>

Discards partial

Source§

fn into(self) -> Entries

Converts this type into the (usually inferred) input type.

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 = 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V