pub struct Tag {
pub object: ObjectId,
pub object_type: ObjectType,
pub name: Vec<u8>,
pub tagger: Option<Vec<u8>>,
pub message: Vec<u8>,
pub raw_body: Option<Vec<u8>>,
}Expand description
A parsed, canonical representation of the annotated tag headers this crate understands.
Tag preserves object, type, tag, optional tagger, and message
bytes. Parsed tags also retain their original body so parse/write can
preserve annotated tag object ids exactly.
Fields§
§object: ObjectId§object_type: ObjectType§name: Vec<u8>§tagger: Option<Vec<u8>>§message: Vec<u8>§raw_body: Option<Vec<u8>>Implementations§
Source§impl Tag
impl Tag
Sourcepub fn parse(format: ObjectFormat, bytes: &[u8]) -> Result<Self>
pub fn parse(format: ObjectFormat, bytes: &[u8]) -> Result<Self>
Parse an annotated tag into the canonical typed representation.
Unknown headers and continuation records are accepted but not retained.
Use EncodedObject for byte-exact tag preservation.
pub fn parse_ref<'a>( format: ObjectFormat, bytes: &'a [u8], ) -> Result<TagRef<'a>>
Sourcepub fn write(&self) -> Vec<u8> ⓘ
pub fn write(&self) -> Vec<u8> ⓘ
Serialize the canonical typed tag representation.
The output contains only the fields represented by Tag; it is not
intended to reproduce raw input bytes that contained unknown headers or
signatures.
Sourcepub fn tagger_signature(&self) -> Option<Signature>
pub fn tagger_signature(&self) -> Option<Signature>
Parse the raw tagger line into a typed Signature
parse-view.
Returns None when the tag has no tagger header or when the stored
bytes are not a well-formed git identity — callers that need to tell
those apart should inspect Tag::tagger directly. This is a read-only
lens over the raw bytes, which stay the source of truth for
Tag::write; the returned signature re-serializes byte-identically to
the stored tagger line.