mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: expose methods and structs (#1607)
This commit is contained in:
@ -88,9 +88,10 @@ struct Cli {
|
|||||||
verbosity: Verbosity,
|
verbosity: Verbosity,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The log configuration.
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
#[command(next_help_heading = "Logging")]
|
#[command(next_help_heading = "Logging")]
|
||||||
struct Logs {
|
pub struct Logs {
|
||||||
/// The path to put log files in.
|
/// The path to put log files in.
|
||||||
#[arg(
|
#[arg(
|
||||||
long = "log.directory",
|
long = "log.directory",
|
||||||
@ -112,7 +113,7 @@ struct Logs {
|
|||||||
|
|
||||||
impl Logs {
|
impl Logs {
|
||||||
/// Builds a tracing layer from the current log options.
|
/// Builds a tracing layer from the current log options.
|
||||||
fn layer<S>(&self) -> (BoxedLayer<S>, Option<FileWorkerGuard>)
|
pub fn layer<S>(&self) -> (BoxedLayer<S>, Option<FileWorkerGuard>)
|
||||||
where
|
where
|
||||||
S: Subscriber,
|
S: Subscriber,
|
||||||
for<'a> S: LookupSpan<'a>,
|
for<'a> S: LookupSpan<'a>,
|
||||||
@ -129,9 +130,10 @@ impl Logs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The verbosity settings for the cli.
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
#[command(next_help_heading = "Display")]
|
#[command(next_help_heading = "Display")]
|
||||||
struct Verbosity {
|
pub struct Verbosity {
|
||||||
/// Set the minimum log level.
|
/// Set the minimum log level.
|
||||||
///
|
///
|
||||||
/// -v Errors
|
/// -v Errors
|
||||||
@ -150,7 +152,7 @@ struct Verbosity {
|
|||||||
impl Verbosity {
|
impl Verbosity {
|
||||||
/// Get the corresponding [Directive] for the given verbosity, or none if the verbosity
|
/// Get the corresponding [Directive] for the given verbosity, or none if the verbosity
|
||||||
/// corresponds to silent.
|
/// corresponds to silent.
|
||||||
fn directive(&self) -> Directive {
|
pub fn directive(&self) -> Directive {
|
||||||
if self.quiet {
|
if self.quiet {
|
||||||
LevelFilter::OFF.into()
|
LevelFilter::OFF.into()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -116,7 +116,8 @@ impl XdgPath for LogsDir {
|
|||||||
|
|
||||||
/// A small helper trait for unit structs that represent a standard path following the XDG
|
/// A small helper trait for unit structs that represent a standard path following the XDG
|
||||||
/// path specification.
|
/// path specification.
|
||||||
trait XdgPath {
|
pub trait XdgPath {
|
||||||
|
/// Resolve the standard path.
|
||||||
fn resolve() -> Option<PathBuf>;
|
fn resolve() -> Option<PathBuf>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -236,9 +236,12 @@ where
|
|||||||
|
|
||||||
/// Represents a gap to sync: from `local_head` to `target`
|
/// Represents a gap to sync: from `local_head` to `target`
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct SyncGap {
|
pub struct SyncGap {
|
||||||
local_head: SealedHeader,
|
/// The local head block. Represents lower bound of sync range.
|
||||||
target: SyncTarget,
|
pub local_head: SealedHeader,
|
||||||
|
|
||||||
|
/// The sync target. Represents upper bound of sync range.
|
||||||
|
pub target: SyncTarget,
|
||||||
}
|
}
|
||||||
|
|
||||||
// === impl SyncGap ===
|
// === impl SyncGap ===
|
||||||
@ -246,7 +249,7 @@ struct SyncGap {
|
|||||||
impl SyncGap {
|
impl SyncGap {
|
||||||
/// Returns `true` if the gap from the head to the target was closed
|
/// Returns `true` if the gap from the head to the target was closed
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_closed(&self) -> bool {
|
pub fn is_closed(&self) -> bool {
|
||||||
self.local_head.hash() == self.target.tip()
|
self.local_head.hash() == self.target.tip()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user