pub struct TypelessObjectDesc { /* private fields */ }
Expand description
无类型的Buffer对象,丢失了SubDesc和DescContent部分的类型信息 实际上也是可以做到带组合类型信息,不过Owner x Area x Author x PublicKey 一共有 24 种组合类型 不过,既然丢失了类型信息,只提供组合类型信息也只是完成了类型信息的一半, 可以通过提供build的方式重建具体的带类型信息的NamedObject,通过调用者注入具体的类型信息完成完整的重构
Implementations§
Source§impl TypelessObjectDesc
丢失了SubDesc类型信息,用成员方法的方式暴露是否含有这些数据
impl TypelessObjectDesc
丢失了SubDesc类型信息,用成员方法的方式暴露是否含有这些数据
pub fn owner(&self) -> &Option<ObjectId>
pub fn area(&self) -> &Option<Area>
pub fn version(&self) -> u8
pub fn format(&self) -> u8
pub fn content(&self) -> &Vec<u8> ⓘ
pub fn convert_to<DescContentT>( self, ) -> BuckyResult<NamedObjectDesc<DescContentT>>
pub fn public_key(&self) -> Option<PublicKeyRef<'_>>
Trait Implementations§
Source§impl Clone for TypelessObjectDesc
impl Clone for TypelessObjectDesc
Source§fn clone(&self) -> TypelessObjectDesc
fn clone(&self) -> TypelessObjectDesc
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TypelessObjectDesc
impl Debug for TypelessObjectDesc
Source§impl ObjectDesc for TypelessObjectDesc
impl ObjectDesc for TypelessObjectDesc
fn obj_type(&self) -> u16
fn calculate_id(&self) -> ObjectId
fn dec_id(&self) -> &Option<ObjectId>
fn ref_objs(&self) -> &Option<Vec<ObjectLink>>
fn prev(&self) -> &Option<ObjectId>
fn create_timestamp(&self) -> &Option<HashValue>
fn create_time(&self) -> u64
fn option_create_time(&self) -> Option<u64>
fn expired_time(&self) -> Option<u64>
fn obj_type_code(&self) -> ObjectTypeCode
fn is_standard_object(&self) -> bool
fn is_core_object(&self) -> bool
fn is_dec_app_object(&self) -> bool
fn object_id(&self) -> ObjectId
Source§impl ObjectFormat for TypelessObjectDesc
impl ObjectFormat for TypelessObjectDesc
fn format_json(&self) -> Value
Source§impl<'de> RawDecodeWithContext<'de, NamedObjectContext> for TypelessObjectDesc
§TypelessObjectDesc 解码
- [1] ctx 部分来自NamedObject里的ctx
- [2] 其余部分为desc本身的解码
impl<'de> RawDecodeWithContext<'de, NamedObjectContext> for TypelessObjectDesc
§TypelessObjectDesc 解码
- [1] ctx 部分来自NamedObject里的ctx
- [2] 其余部分为desc本身的解码
fn raw_decode_with_context( buf: &'de [u8], ctx: NamedObjectContext, ) -> BuckyResult<(Self, &'de [u8])>
Source§impl RawEncode for TypelessObjectDesc
§TypelessObjectDesc 用于计算ID用的编码
- [1] ctx 部分包含obj_type, obj_flags 信息(前5bits为0,区别于NamedObject里的ctx.obj_flags)
- [2] 其余部分为desc本身的编码
impl RawEncode for TypelessObjectDesc
§TypelessObjectDesc 用于计算ID用的编码
- [1] ctx 部分包含obj_type, obj_flags 信息(前5bits为0,区别于NamedObject里的ctx.obj_flags)
- [2] 其余部分为desc本身的编码
fn raw_measure(&self, purpose: &Option<RawEncodePurpose>) -> BuckyResult<usize>
fn raw_encode<'a>( &self, buf: &'a mut [u8], purpose: &Option<RawEncodePurpose>, ) -> BuckyResult<&'a mut [u8]>
fn raw_encode_to_buffer(&self) -> BuckyResult<Vec<u8>>
fn raw_hash_encode(&self) -> BuckyResult<Vec<u8>>
fn raw_tail_encode<'a>( &self, buf: &'a mut [u8], purpose: &Option<RawEncodePurpose>, ) -> BuckyResult<&'a [u8]>
fn raw_hash_value(&self) -> BuckyResult<HashValue>
fn hash_buf(&self, encoded_buf: &[u8]) -> HashValue
Source§impl RawEncodeWithContext<NamedObjectContext> for TypelessObjectDesc
§TypelessObjectDesc 编码
- [1] ctx 部分来自NamedObject里的ctx
- [2] 其余部分为desc本身的编码
impl RawEncodeWithContext<NamedObjectContext> for TypelessObjectDesc
§TypelessObjectDesc 编码
- [1] ctx 部分来自NamedObject里的ctx
- [2] 其余部分为desc本身的编码
fn raw_measure_with_context( &self, ctx: &mut NamedObjectContext, purpose: &Option<RawEncodePurpose>, ) -> BuckyResult<usize>
fn raw_encode_with_context<'a>( &self, buf: &'a mut [u8], _ctx: &mut NamedObjectContext, purpose: &Option<RawEncodePurpose>, ) -> BuckyResult<&'a mut [u8]>
fn raw_tail_encode_with_context<'a>( &self, buf: &'a mut [u8], context: &mut Context, purpose: &Option<RawEncodePurpose>, ) -> BuckyResult<&'a [u8]>
Auto Trait Implementations§
impl Freeze for TypelessObjectDesc
impl RefUnwindSafe for TypelessObjectDesc
impl Send for TypelessObjectDesc
impl Sync for TypelessObjectDesc
impl Unpin for TypelessObjectDesc
impl UnwindSafe for TypelessObjectDesc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<D> FileEncoder<D> for Dwhere
D: RawEncode,
impl<D> FileEncoder<D> for Dwhere
D: RawEncode,
fn suggest_buffer_size(&self) -> Result<usize, BuckyError>
fn encode<'a>( &self, buf: &'a mut [u8], _is_compress: bool, ) -> Result<&'a mut [u8], BuckyError>
fn encode_to_writer( &self, writer: impl Write, is_compress: bool, ) -> BuckyResult<usize>
fn encode_to_file(&self, file: &Path, is_compress: bool) -> BuckyResult<usize>
fn encode_to_vec(&self, is_compress: bool) -> BuckyResult<Vec<u8>>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more