Skip to main content

CreateFromFile

Struct CreateFromFile 

Source
pub struct CreateFromFile {
    pub path: PathBuf,
    pub content_location: Option<Url>,
    pub content_type: String,
    pub cache_in_ram: bool,
    pub compute_md5: bool,
    pub config: TransferConfig,
}
Expand description

Typed builder for creating an ObjectDesc from a file.

§Example

use flute::sender::CreateFromFile;

let obj = CreateFromFile::builder()
    .path(std::path::PathBuf::from("/tmp/test.bin"))
    .content_type("application/octet-stream".to_string())
    .build()
    .create()
    .unwrap();

Fields§

§path: PathBuf

Path to the file

§content_location: Option<Url>

Supply the resource location for this object

§content_type: String

Media type of the object

§cache_in_ram: bool

If true, the file is read and cached in RAM

§compute_md5: bool

If true, compute and attach the MD5 hash

§config: TransferConfig

Transfer configuration (shared optional parameters)

Implementations§

Source§

impl CreateFromFile

Source

pub fn builder() -> CreateFromFileBuilder<((), (), (), (), (), ())>

Create a builder for building CreateFromFile. On the builder, call .path(...), .content_location(...)(optional), .content_type(...), .cache_in_ram(...)(optional), .compute_md5(...)(optional), .config(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of CreateFromFile.

Source§

impl CreateFromFile

Source

pub fn create(self) -> Result<Box<ObjectDesc>>

Create the ObjectDesc from the configured file parameters.

Trait Implementations§

Source§

impl Debug for CreateFromFile

Source§

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

Formats the value using the given formatter. 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> 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.