Struct edjx::FileAttributes

source ·
pub struct FileAttributes {
    pub properties: Option<HashMap<String, String>>,
    pub default_version: Option<String>,
}
Expand description

Represents the attributes associated with a stored file.

Fields§

§properties: Option<HashMap<String, String>>§default_version: Option<String>

Implementations§

Examples found in repository?
src/storage.rs (line 363)
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
pub fn get_attributes<B, FN>(bucket_id: B, file_name: FN) -> Result<FileAttributes, StorageError>
where
    B: AsRef<str>,
    FN: AsRef<str>,
{
    let bucket_id_str = bucket_id.as_ref();
    let file_name_str = file_name.as_ref();

    if file_name_str.trim().is_empty() {
        return Err(StorageError::MissingFileName);
    }

    if bucket_id_str.trim().is_empty() {
        return Err(StorageError::MissingBucketID);
    }

    let mut error_code: i32 = 0;

    let response_value = unsafe {
        host_storage_get_attributes(
            bucket_id_str.as_ptr(),
            bucket_id_str.len() as u32,
            file_name_str.as_ptr(),
            file_name_str.len() as u32,
            &mut error_code,
        )
    };

    if response_value < 0 {
        return Err(StorageError::from(Error::from_i32(error_code).unwrap()));
    }

    let mut resp = match StorageResponse::new() {
        Ok(resp) => resp,
        Err(err) => return Err(err),
    };

    match resp.read_body() {
        Ok(body) => FileAttributes::from_bytes(body),
        Err(_) => Err(StorageError::InternalError),
    }
}

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.