Struct Object

Source
#[non_exhaustive]
pub struct Object<PointerSel: PointerFamily = ArcPointer> { /* private fields */ }
Expand description

存放单个对象的结构体

Implementations§

Source§

impl<T: PointerFamily> Object<T>

Source

pub fn new( bucket: T::Bucket, path: ObjectPath, last_modified: DateTime<Utc>, etag: String, _type: String, size: u64, storage_class: StorageClass, ) -> Self

初始化 Object 结构体

Source

pub fn base(&self) -> &ObjectBase<T>

读取 Object 元信息

Source

pub fn set_base(&mut self, base: ObjectBase<T>)

设置 Object 元信息

Source

pub fn last_modified(&self) -> &DateTime<Utc>

读取最后修改时间

Source

pub fn set_last_modified(&mut self, last_modified: DateTime<Utc>)

设置最后修改时间

Source

pub fn etag(&self) -> &String

读取 etag 信息

Source

pub fn set_etag(&mut self, etag: String)

设置 etag

Source

pub fn get_type_string(&self) -> &String

读取 type

Source

pub fn set_type_string(&mut self, _type: String)

设置 type

Source

pub fn size(&self) -> u64

读取文件 size

Source

pub fn set_size(&mut self, size: u64)

设置文件 size

Source

pub fn storage_class(&self) -> &StorageClass

读取 storage_class

Source

pub fn set_storage_class(&mut self, storage_class: StorageClass)

设置 storage_class

Source

pub fn pieces( self, ) -> (ObjectBase<T>, DateTime<Utc>, String, String, u64, StorageClass)

获取一部分数据

Source

pub fn path(&self) -> ObjectPath

读取 文件路径

Source§

impl Object<ArcPointer>

Source

pub fn builder(path: ObjectPath) -> ObjectBuilder<ArcPointer>

§Object 构建器

用例

let bucket = BucketBase::new(
    "bucket-name".parse().unwrap(),
    EndPoint::CN_QINGDAO,
);
let mut builder = ObjectArc::builder("abc".parse::<ObjectPath>().unwrap());

builder
    .bucket_base(bucket)
    .last_modified(DateTime::<Utc>::from_utc(
        NaiveDateTime::from_timestamp_opt(123000, 0).unwrap(),
        Utc,
    ))
    .etag("foo1".to_owned())
    .set_type("foo2".to_owned())
    .size(123)
    .storage_class(StorageClass::IA);

let object = builder.build();
Source

pub fn to_sign_url(&self, key: &KeyId, secret: &KeySecret, expires: i64) -> Url

带签名的 Url 链接

Source§

impl Object<RcPointer>

Source

pub fn builder(path: ObjectPath) -> ObjectBuilder<RcPointer>

§Object 构建器

用例

let bucket = BucketBase::new(
    "bucket-name".parse().unwrap(),
    EndPoint::CN_QINGDAO,
);
let mut builder = ObjectArc::builder("abc".parse::<ObjectPath>().unwrap());

builder
    .bucket_base(bucket)
    .last_modified(DateTime::<Utc>::from_utc(
        NaiveDateTime::from_timestamp_opt(123000, 0).unwrap(),
        Utc,
    ))
    .etag("foo1".to_owned())
    .set_type("foo2".to_owned())
    .size(123)
    .storage_class(StorageClass::IA);

let object = builder.build();
Source

pub fn to_sign_url(&self, key: &KeyId, secret: &KeySecret, expires: i64) -> Url

带签名的 Url 链接

Trait Implementations§

Source§

impl<T: PointerFamily> AsRef<DateTime<Utc>> for Object<T>

Source§

fn as_ref(&self) -> &DateTime<Utc>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: PointerFamily> AsRef<ObjectPathInner<'static>> for Object<T>

Source§

fn as_ref(&self) -> &ObjectPath

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: PointerFamily> AsRef<StorageClass> for Object<T>

Source§

fn as_ref(&self) -> &StorageClass

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<PointerSel: Clone + PointerFamily> Clone for Object<PointerSel>

Source§

fn clone(&self) -> Object<PointerSel>

Returns a copy 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<PointerSel: Debug + PointerFamily> Debug for Object<PointerSel>

Source§

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

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

impl<T: PointerFamily> Default for Object<T>

Source§

fn default() -> Self

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

impl<T: PointerFamily> From<Object<T>> for ObjectPathInner<'static>

Source§

fn from(obj: Object<T>) -> Self

Converts to this type from the input type.
Source§

impl GetStd for Object<ArcPointer>

Source§

fn get_std(&self) -> Option<(Url, CanonicalizedResource)>

获取 UrlCanonicalizedResource
Source§

impl InitObject<Object<RcPointer>> for ObjectList<RcPointer, Object<RcPointer>>

Source§

fn init_object(&mut self) -> Option<Object<RcPointer>>

初始化 object 的类型 Read more
Source§

impl InitObject<Object> for ObjectList<ArcPointer, Object<ArcPointer>>

Source§

fn init_object(&mut self) -> Option<Object<ArcPointer>>

初始化 object 的类型 Read more
Source§

impl<T: PointerFamily> PartialEq<DateTime<Utc>> for Object<T>

Source§

fn eq(&self, other: &DateTime<Utc>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<ObjectBase<RcPointer>> for Object<RcPointer>

Source§

fn eq(&self, other: &ObjectBase<RcPointer>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<ObjectBase> for Object<ArcPointer>

Source§

fn eq(&self, other: &ObjectBase<ArcPointer>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PointerFamily> PartialEq<u64> for Object<T>

Source§

fn eq(&self, other: &u64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Object<ArcPointer>

Source§

fn eq(&self, other: &Object<ArcPointer>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Object<RcPointer>

Source§

fn eq(&self, other: &Object<RcPointer>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PointerFamily> RefineObject<BuildInItemError> for Object<T>

Source§

fn set_key(&mut self, key: &str) -> Result<(), BuildInItemError>

提取 key
Source§

fn set_last_modified(&mut self, value: &str) -> Result<(), BuildInItemError>

提取最后修改时间
Source§

fn set_etag(&mut self, value: &str) -> Result<(), BuildInItemError>

提取 etag
Source§

fn set_type(&mut self, value: &str) -> Result<(), BuildInItemError>

提取 type
Source§

fn set_size(&mut self, size: &str) -> Result<(), BuildInItemError>

提取 size
Source§

fn set_storage_class( &mut self, storage_class: &str, ) -> Result<(), BuildInItemError>

提取 storage_class
Source§

fn decode(&mut self, xml: &str) -> Result<(), InnerItemError>

对单个 objcet 部分的 xml 内容进行解析

Auto Trait Implementations§

§

impl<PointerSel> Freeze for Object<PointerSel>
where <PointerSel as PointerFamily>::Bucket: Freeze,

§

impl<PointerSel> RefUnwindSafe for Object<PointerSel>
where <PointerSel as PointerFamily>::Bucket: RefUnwindSafe,

§

impl<PointerSel> Send for Object<PointerSel>
where <PointerSel as PointerFamily>::Bucket: Send,

§

impl<PointerSel> Sync for Object<PointerSel>
where <PointerSel as PointerFamily>::Bucket: Sync,

§

impl<PointerSel> Unpin for Object<PointerSel>
where <PointerSel as PointerFamily>::Bucket: Unpin,

§

impl<PointerSel> UnwindSafe for Object<PointerSel>
where <PointerSel as PointerFamily>::Bucket: UnwindSafe,

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,