Struct branchless::git::Repo
source · [−]pub struct Repo { /* private fields */ }
Expand description
Wrapper around git2::Repository
.
Implementations
sourceimpl Repo
impl Repo
sourcepub fn from_dir(path: &Path) -> Result<Self>
pub fn from_dir(path: &Path) -> Result<Self>
Get the Git repository associated with the given directory.
sourcepub fn from_current_dir() -> Result<Self>
pub fn from_current_dir() -> Result<Self>
Get the Git repository associated with the current directory.
sourcepub fn get_packed_refs_path(&self) -> PathBuf
pub fn get_packed_refs_path(&self) -> PathBuf
Get the path to the packed-refs
file for the repository.
sourcepub fn get_rebase_state_dir_path(&self) -> PathBuf
pub fn get_rebase_state_dir_path(&self) -> PathBuf
Get the path to the directory inside the .git
directory which contains
state used for the current rebase (if any).
sourcepub fn get_working_copy_path(&self) -> Option<&Path>
pub fn get_working_copy_path(&self) -> Option<&Path>
Get the path to the working copy for this repository. If the repository
is bare (has no working copy), returns None
.
sourcepub fn get_readonly_config(&self) -> Result<impl ConfigRead>
pub fn get_readonly_config(&self) -> Result<impl ConfigRead>
Get the configuration object for the repository.
Warning: This object should only be used for read operations. Write
operations should go to the config
file under the .git/branchless
directory.
sourcepub fn get_config_path(&self) -> PathBuf
pub fn get_config_path(&self) -> PathBuf
Get the file where git-branchless-specific Git configuration is stored.
sourcepub fn get_dag_dir(&self) -> PathBuf
pub fn get_dag_dir(&self) -> PathBuf
Get the directory where the DAG for the repository is stored.
sourcepub fn get_man_dir(&self) -> PathBuf
pub fn get_man_dir(&self) -> PathBuf
Get the directory to store man-pages. Note that this is the man
directory, and not a subsection thereof. git-branchless
man-pages must
go into the man/man1
directory to be found by man
.
sourcepub fn get_tempfile_dir(&self) -> PathBuf
pub fn get_tempfile_dir(&self) -> PathBuf
Get a directory suitable for storing temporary files.
In particular, this directory is guaranteed to be on the same filesystem as the Git repository itself, so you can move files between them atomically. See https://github.com/arxanas/git-branchless/discussions/120.
sourcepub fn get_db_conn(&self) -> Result<Connection>
pub fn get_db_conn(&self) -> Result<Connection>
Get the connection to the SQLite database for this repository.
sourcepub fn resolve_reference(
&self,
reference: &Reference<'_>
) -> Result<ResolvedReferenceInfo<'_>>
pub fn resolve_reference(
&self,
reference: &Reference<'_>
) -> Result<ResolvedReferenceInfo<'_>>
Get a snapshot of information about a given reference.
sourcepub fn get_head_info(&self) -> Result<ResolvedReferenceInfo<'_>>
pub fn get_head_info(&self) -> Result<ResolvedReferenceInfo<'_>>
Get the OID for the repository’s HEAD
reference.
sourcepub fn set_head(&self, oid: NonZeroOid) -> Result<()>
pub fn set_head(&self, oid: NonZeroOid) -> Result<()>
Set the HEAD
reference directly to the provided oid
. Does not touch
the working copy.
sourcepub fn detach_head(&self, head_info: &ResolvedReferenceInfo<'_>) -> Result<()>
pub fn detach_head(&self, head_info: &ResolvedReferenceInfo<'_>) -> Result<()>
Detach HEAD
by making it point directly to its current OID, rather
than to a branch. If HEAD
is already detached, logs a warning.
sourcepub fn get_main_branch_reference(&self) -> Result<Reference<'_>>
pub fn get_main_branch_reference(&self) -> Result<Reference<'_>>
Get the Reference
for the main branch for the repository.
sourcepub fn get_main_branch_oid(&self) -> Result<NonZeroOid>
pub fn get_main_branch_oid(&self) -> Result<NonZeroOid>
Get the OID corresponding to the main branch.
sourcepub fn get_branch_oid_to_names(
&self
) -> Result<HashMap<NonZeroOid, HashSet<OsString>>>
pub fn get_branch_oid_to_names(
&self
) -> Result<HashMap<NonZeroOid, HashSet<OsString>>>
Get a mapping from OID to the names of branches which point to that OID.
The returned branch names include the refs/heads/
prefix, so it must
be stripped if desired.
sourcepub fn get_references_snapshot(&self) -> Result<RepoReferencesSnapshot>
pub fn get_references_snapshot(&self) -> Result<RepoReferencesSnapshot>
Get the positions of references in the repository.
sourcepub fn is_rebase_underway(&self) -> Result<bool>
pub fn is_rebase_underway(&self) -> Result<bool>
Detect if an interactive rebase has started but not completed.
Git will send us spurious post-rewrite
events marked as amend
during an
interactive rebase, indicating that some of the commits have been rewritten
as part of the rebase plan, but not all of them. This function attempts to
detect when an interactive rebase is underway, and if the current
post-rewrite
event is spurious.
There are two practical issues for users as a result of this Git behavior:
-
During an interactive rebase, we may see many “processing 1 rewritten commit” messages, and then a final “processing X rewritten commits” message once the rebase has concluded. This is potentially confusing for users, since the operation logically only rewrote the commits once, but we displayed the message multiple times.
-
During an interactive rebase, we may warn about abandoned commits, when the next operation in the rebase plan fixes up the abandoned commit. This can happen even if no conflict occurred and the rebase completed successfully without any user intervention.
sourcepub fn get_current_operation_type(&self) -> Option<&str>
pub fn get_current_operation_type(&self) -> Option<&str>
Get the type current multi-step operation (such as rebase
or
cherry-pick
) which is underway. Returns None
if there is no such
operation.
sourcepub fn find_merge_base(
&self,
lhs: NonZeroOid,
rhs: NonZeroOid
) -> Result<Option<NonZeroOid>>
pub fn find_merge_base(
&self,
lhs: NonZeroOid,
rhs: NonZeroOid
) -> Result<Option<NonZeroOid>>
Find the merge-base between two commits. Returns None
if a merge-base
could not be found.
sourcepub fn get_patch_for_commit(
&self,
effects: &Effects,
commit: &Commit<'_>
) -> Result<Option<Diff<'_>>>
pub fn get_patch_for_commit(
&self,
effects: &Effects,
commit: &Commit<'_>
) -> Result<Option<Diff<'_>>>
Get the patch for a commit, i.e. the diff between that commit and its parent.
If the commit has more than one parent, returns None
.
sourcepub fn get_staged_paths(&self) -> Result<HashSet<PathBuf>>
pub fn get_staged_paths(&self) -> Result<HashSet<PathBuf>>
Returns the set of paths currently staged to the repository’s index.
sourcepub fn get_paths_touched_by_commit(
&self,
commit: &Commit<'_>
) -> Result<Option<HashSet<PathBuf>>>
pub fn get_paths_touched_by_commit(
&self,
commit: &Commit<'_>
) -> Result<Option<HashSet<PathBuf>>>
Get the file paths which were added, removed, or changed by the given commit.
If the commit has no parents, returns all of the file paths in that commit’s tree.
If the commit has more than one parent, returns None
.
sourcepub fn get_patch_id(
&self,
effects: &Effects,
commit: &Commit<'_>
) -> Result<Option<PatchId>>
pub fn get_patch_id(
&self,
effects: &Effects,
commit: &Commit<'_>
) -> Result<Option<PatchId>>
Get the patch ID for this commit.
sourcepub fn revparse_single_commit(&self, spec: &str) -> Result<Option<Commit<'_>>>
pub fn revparse_single_commit(&self, spec: &str) -> Result<Option<Commit<'_>>>
Attempt to parse the user-provided object descriptor.
sourcepub fn get_reference(
&self,
reference_name: &OsStr
) -> Result<Option<Reference<'_>>>
pub fn get_reference(
&self,
reference_name: &OsStr
) -> Result<Option<Reference<'_>>>
Look up a single reference by name.
sourcepub fn get_all_references(&self) -> Result<Vec<Reference<'_>>>
pub fn get_all_references(&self) -> Result<Vec<Reference<'_>>>
Find all references in the repository.
sourcepub fn has_changed_files(
&self,
effects: &Effects,
git_run_info: &GitRunInfo
) -> Result<bool>
pub fn has_changed_files(
&self,
effects: &Effects,
git_run_info: &GitRunInfo
) -> Result<bool>
Check if the repository has staged or unstaged changes. Untracked files are not included. This operation may take a while.
sourcepub fn get_status(
&self,
git_run_info: &GitRunInfo,
event_tx_id: Option<EventTransactionId>
) -> Result<Vec<StatusEntry>>
pub fn get_status(
&self,
git_run_info: &GitRunInfo,
event_tx_id: Option<EventTransactionId>
) -> Result<Vec<StatusEntry>>
Returns the current status of the repo index and working copy.
sourcepub fn create_reference(
&self,
name: &OsStr,
oid: NonZeroOid,
force: bool,
log_message: &str
) -> Result<Reference<'_>>
pub fn create_reference(
&self,
name: &OsStr,
oid: NonZeroOid,
force: bool,
log_message: &str
) -> Result<Reference<'_>>
Create a new reference or update an existing one.
sourcepub fn find_reference(&self, name: &OsStr) -> Result<Option<Reference<'_>>>
pub fn find_reference(&self, name: &OsStr) -> Result<Option<Reference<'_>>>
Look up a reference with the given name. Returns None
if not found.
sourcepub fn get_all_local_branches(&self) -> Result<Vec<Branch<'_>>>
pub fn get_all_local_branches(&self) -> Result<Vec<Branch<'_>>>
Get all local branches in the repository.
sourcepub fn find_branch(
&self,
name: &str,
branch_type: BranchType
) -> Result<Option<Branch<'_>>>
pub fn find_branch(
&self,
name: &str,
branch_type: BranchType
) -> Result<Option<Branch<'_>>>
Look up the branch with the given name. Returns None
if not found.
sourcepub fn create_branch(
&self,
name: &OsStr,
target: &Commit<'_>,
force: bool
) -> Result<Branch<'_>>
pub fn create_branch(
&self,
name: &OsStr,
target: &Commit<'_>,
force: bool
) -> Result<Branch<'_>>
Create a new branch or update an existing branch.
sourcepub fn find_commit(&self, oid: NonZeroOid) -> Result<Option<Commit<'_>>>
pub fn find_commit(&self, oid: NonZeroOid) -> Result<Option<Commit<'_>>>
Look up a commit with the given OID. Returns None
if not found.
sourcepub fn find_commit_or_fail(&self, oid: NonZeroOid) -> Result<Commit<'_>>
pub fn find_commit_or_fail(&self, oid: NonZeroOid) -> Result<Commit<'_>>
Like find_commit
, but raises a generic error if the commit could not
be found.
sourcepub fn friendly_describe_commit_from_oid(
&self,
glyphs: &Glyphs,
oid: NonZeroOid
) -> Result<StyledString>
pub fn friendly_describe_commit_from_oid(
&self,
glyphs: &Glyphs,
oid: NonZeroOid
) -> Result<StyledString>
Look up the commit with the given OID and render a friendly description of it, or render an error message if not found.
sourcepub fn create_commit(
&self,
update_ref: Option<&str>,
author: &Signature<'_>,
committer: &Signature<'_>,
message: &str,
tree: &Tree<'_>,
parents: Vec<&Commit<'_>>
) -> Result<NonZeroOid>
pub fn create_commit(
&self,
update_ref: Option<&str>,
author: &Signature<'_>,
committer: &Signature<'_>,
message: &str,
tree: &Tree<'_>,
parents: Vec<&Commit<'_>>
) -> Result<NonZeroOid>
Create a new commit.
sourcepub fn cherry_pick_commit(
&self,
cherry_pick_commit: &Commit<'_>,
our_commit: &Commit<'_>,
mainline: u32
) -> Result<Index>
pub fn cherry_pick_commit(
&self,
cherry_pick_commit: &Commit<'_>,
our_commit: &Commit<'_>,
mainline: u32
) -> Result<Index>
Cherry-pick a commit in memory and return the resulting index.
sourcepub fn cherry_pick_fast<'repo>(
&'repo self,
patch_commit: &'repo Commit<'_>,
target_commit: &'repo Commit<'_>,
options: &CherryPickFastOptions
) -> Result<Result<Tree<'repo>, CherryPickFastError>>
pub fn cherry_pick_fast<'repo>(
&'repo self,
patch_commit: &'repo Commit<'_>,
target_commit: &'repo Commit<'_>,
options: &CherryPickFastOptions
) -> Result<Result<Tree<'repo>, CherryPickFastError>>
Cherry-pick a commit in memory and return the resulting tree.
The libgit2
routines operate on entire Index
es, which contain one
entry per file in the repository. When operating on a large repository,
this is prohibitively slow, as it takes several seconds just to write
the index to disk. To improve performance, we reduce the size of the
involved indexes by filtering out any unchanged entries from the input
trees, then call into libgit2
, then add back the unchanged entries to
the output tree.
sourcepub fn find_tree(&self, oid: NonZeroOid) -> Result<Option<Tree<'_>>>
pub fn find_tree(&self, oid: NonZeroOid) -> Result<Option<Tree<'_>>>
Look up the tree with the given OID. Returns None
if not found.
sourcepub fn find_tree_or_fail(&self, oid: NonZeroOid) -> Result<Tree<'_>>
pub fn find_tree_or_fail(&self, oid: NonZeroOid) -> Result<Tree<'_>>
Like find_tree
, but raises a generic error if the commit could not
be found.
sourcepub fn write_index_to_tree(&self, index: &mut Index) -> Result<NonZeroOid>
pub fn write_index_to_tree(&self, index: &mut Index) -> Result<NonZeroOid>
Write the provided in-memory index as a tree into Git`s object database. There must be no merge conflicts in the index.
sourcepub fn amend_fast(
&self,
parent_commit: &Commit<'_>,
opts: &AmendFastOptions
) -> Result<Tree<'_>>
pub fn amend_fast(
&self,
parent_commit: &Commit<'_>,
opts: &AmendFastOptions
) -> Result<Tree<'_>>
Amends the provided parent commit in memory and returns the resulting tree.
Only amends the files provided in the options, and only supports amending from either the working tree or the index, but not both.
See Repo::cherry_pick_fast
for motivation for performing the operation
in-memory.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Repo
impl Send for Repo
impl !Sync for Repo
impl Unpin for Repo
impl UnwindSafe for Repo
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<D> OwoColorize for D
impl<D> OwoColorize for D
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self> where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self> where
C: Color,
Set the foreground color generically Read more
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self> where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self> where
C: Color,
Set the background color generically. Read more
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
Change the foreground color to black
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
Change the background color to black
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
Change the foreground color to red
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
Change the background color to red
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
Change the foreground color to green
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
Change the background color to green
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
Change the foreground color to yellow
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
Change the background color to yellow
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
Change the foreground color to blue
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
Change the background color to blue
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Change the foreground color to magenta
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Change the background color to magenta
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Change the foreground color to purple
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Change the background color to purple
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
Change the foreground color to cyan
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
Change the background color to cyan
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
Change the foreground color to white
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
Change the background color to white
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
Change the foreground color to the terminal default
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
Change the background color to the terminal default
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
Change the foreground color to bright black
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
Change the background color to bright black
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
Change the foreground color to bright red
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
Change the background color to bright red
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
Change the foreground color to bright green
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
Change the background color to bright green
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
Change the foreground color to bright yellow
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
Change the background color to bright yellow
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
Change the foreground color to bright blue
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
Change the background color to bright blue
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright magenta
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Change the background color to bright magenta
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright purple
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Change the background color to bright purple
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
Change the foreground color to bright cyan
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
Change the background color to bright cyan
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
Change the foreground color to bright white
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
Change the background color to bright white
fn bold(&'a self) -> BoldDisplay<'a, Self>
fn bold(&'a self) -> BoldDisplay<'a, Self>
Make the text bold
fn dimmed(&'a self) -> DimDisplay<'a, Self>
fn dimmed(&'a self) -> DimDisplay<'a, Self>
Make the text dim
fn italic(&'a self) -> ItalicDisplay<'a, Self>
fn italic(&'a self) -> ItalicDisplay<'a, Self>
Make the text italicized
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
Make the text italicized
fn blink(&'a self) -> BlinkDisplay<'a, Self>
fn blink(&'a self) -> BlinkDisplay<'a, Self>
Make the text blink
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
Make the text blink (but fast!)
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
Swap the foreground and background colors
Hide the text
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
Cross out the text
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
Set the foreground color at runtime. Only use if you do not know which color will be used at
compile-time. If the color is constant, use either OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
Set the background color at runtime. Only use if you do not know what color to use at
compile-time. If the color is constant, use either OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more
fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the foreground color to a specific RGB value.
fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the background color to a specific RGB value.
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Sets the foreground color to an RGB value.
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Sets the background color to an RGB value.
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> With for T
impl<T> With for T
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more