Trait git_object::WriteTo

source ·
pub trait WriteTo {
    // Required methods
    fn write_to(&self, out: impl Write) -> Result<()>;
    fn kind(&self) -> Kind;
    fn size(&self) -> usize;

    // Provided method
    fn loose_header(&self) -> SmallVec<[u8; 28]> { ... }
}
Expand description

Writing of objects to a Write implementation

Required Methods§

source

fn write_to(&self, out: impl Write) -> Result<()>

Write a representation of this instance to out.

source

fn kind(&self) -> Kind

Returns the type of this object.

source

fn size(&self) -> usize

Returns the size of this object’s representation (the amount of data which would be written by write_to).

size’s value has no bearing on the validity of the object, as such it’s possible for size to return a sensible value but write_to to fail because the object was not actually valid in some way.

Provided Methods§

source

fn loose_header(&self) -> SmallVec<[u8; 28]>

Returns a loose object header based on the object’s data

Implementations on Foreign Types§

source§

impl<T> WriteTo for &Twhere T: WriteTo,

source§

fn write_to(&self, out: impl Write) -> Result<()>

source§

fn size(&self) -> usize

source§

fn kind(&self) -> Kind

Implementors§

source§

impl WriteTo for Object

Serialization

source§

impl WriteTo for Blob

source§

impl WriteTo for Commit

source§

impl WriteTo for Tag

source§

impl WriteTo for Tree

Serialization

source§

impl<'a> WriteTo for ObjectRef<'a>

Serialization

source§

impl<'a> WriteTo for BlobRef<'a>

source§

impl<'a> WriteTo for CommitRef<'a>

source§

impl<'a> WriteTo for TagRef<'a>

source§

impl<'a> WriteTo for TreeRef<'a>

Serialization