pub struct Root(/* private fields */);
Expand description
The wrapper type for the underlying type which will be used to represent
the “root” identifier for an crate::AtomId
. For git, this is a [gix::ObjectId
]
representing the original commit made in the repositories history.
The wrapper helps disambiguate at the type level between object ids and the root id.
Methods from Deref<Target = ObjectId>§
pub fn kind(&self) -> Kind
pub fn kind(&self) -> Kind
Returns the kind of hash used in this instance.
pub fn is_empty_blob(&self) -> bool
pub fn is_empty_blob(&self) -> bool
Returns true
if this hash is equal to an empty blob.
pub fn is_empty_tree(&self) -> bool
pub fn is_empty_tree(&self) -> bool
Returns true
if this hash is equal to an empty tree.
Methods from Deref<Target = oid>§
pub fn kind(&self) -> Kind
pub fn kind(&self) -> Kind
The kind of hash used for this instance.
pub fn first_byte(&self) -> u8
pub fn first_byte(&self) -> u8
The first byte of the hash, commonly used to partition a set of object ids.
pub fn to_hex_with_len(&self, len: usize) -> HexDisplay<'_>
pub fn to_hex_with_len(&self, len: usize) -> HexDisplay<'_>
Return a type which can display itself in hexadecimal form with the len
amount of characters.
pub fn to_hex(&self) -> HexDisplay<'_>
pub fn to_hex(&self) -> HexDisplay<'_>
Return a type which displays this oid as hex in full.
pub fn hex_to_buf<'a>(&self, buf: &'a mut [u8]) -> &'a mut str
pub fn hex_to_buf<'a>(&self, buf: &'a mut [u8]) -> &'a mut str
Write ourselves to the out
in hexadecimal notation, returning the hex-string ready for display.
Panics if the buffer isn’t big enough to hold twice as many bytes as the current binary size.
pub fn write_hex_to(&self, out: &mut dyn Write) -> Result<(), Error>
pub fn write_hex_to(&self, out: &mut dyn Write) -> Result<(), Error>
Write ourselves to out
in hexadecimal notation.
Trait Implementations§
Source§impl<'a> Builder<'a, Root> for GitPublisher<'a>
impl<'a> Builder<'a, Root> for GitPublisher<'a>
Source§type Error = Error
type Error = Error
Builder::build
method.Source§type Publisher = GitContext<'a>
type Publisher = GitContext<'a>
Publish
implementation to construct.Source§impl<'repo> Init<Root, Ref, Box<dyn Transport + Send>> for Remote<'repo>
impl<'repo> Init<Root, Ref, Box<dyn Transport + Send>> for Remote<'repo>
Source§fn ekala_root(
&self,
transport: Option<&mut Box<dyn Transport + Send>>,
) -> Result<Root, Self::Error>
fn ekala_root( &self, transport: Option<&mut Box<dyn Transport + Send>>, ) -> Result<Root, Self::Error>
Determines if this remote is a valid Ekala store by pulling HEAD and the root tag, ensuring the latter is actually the root of HEAD, returning the root.
Source§fn sync(
&self,
transport: Option<&mut Box<dyn Transport + Send>>,
) -> Result<Ref, Error>
fn sync( &self, transport: Option<&mut Box<dyn Transport + Send>>, ) -> Result<Ref, Error>
Sync with the given remote and get the most up to date HEAD according to it.
Source§impl<'a> Publish<Root> for GitContext<'a>
impl<'a> Publish<Root> for GitContext<'a>
Source§fn publish<C>(
&self,
paths: C,
remotes: HashMap<AtomTag, (Version, ObjectId)>,
) -> Vec<GitResult<GitOutcome>> ⓘwhere
C: IntoIterator<Item = PathBuf>,
fn publish<C>(
&self,
paths: C,
remotes: HashMap<AtomTag, (Version, ObjectId)>,
) -> Vec<GitResult<GitOutcome>> ⓘwhere
C: IntoIterator<Item = PathBuf>,
Publishes atoms.
This function processes a collection of paths, each representing an atom to be published. The publishing process includes path normalization, existence checks, and actual publishing attempts.
§Path Normalization
- First attempts to interpret each path as relative to the caller’s current location inside the repository.
- If normalization fails (e.g., in a bare repository), falls back to treating the path as already relative to the repo root.
- The normalized path is used to search the Git history, not the file system.
§Publishing Process
For each path:
- Normalizes the path (as described above).
- Checks if the atom already exists in the repository.
- If it exists, the atom is skipped, and a log message is generated.
- Attempts to publish the atom.
- If successful, the atom is added to the repository.
- If any error occurs during publishing, the atom is skipped, and an error is logged.
§Error Handling
- The function aims to process all provided paths, even if some fail.
- Errors and skipped atoms are collected as results but do not halt the overall process.
- The function continues until all the atoms have been processed.
§Return Value
Returns a vector of results types (Vec<Result<PublishOutcome<T>, Self::Error>>
), where the
outter result represents whether an atom has failed, and the inner result determines whether
an atom was safely skipped, e.g. because it already exists..
impl Copy for Root
impl Eq for Root
impl StructuralPartialEq for Root
Auto Trait Implementations§
impl Freeze for Root
impl RefUnwindSafe for Root
impl Send for Root
impl Sync for Root
impl Unpin for Root
impl UnwindSafe for Root
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute
] value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
[Quirk
] value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition
] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Upper case
letters are used (e.g. F9B4CA
)