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,
|
||||
}
|
||||
|
||||
/// The log configuration.
|
||||
#[derive(Args)]
|
||||
#[command(next_help_heading = "Logging")]
|
||||
struct Logs {
|
||||
pub struct Logs {
|
||||
/// The path to put log files in.
|
||||
#[arg(
|
||||
long = "log.directory",
|
||||
@ -112,7 +113,7 @@ struct Logs {
|
||||
|
||||
impl Logs {
|
||||
/// 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
|
||||
S: Subscriber,
|
||||
for<'a> S: LookupSpan<'a>,
|
||||
@ -129,9 +130,10 @@ impl Logs {
|
||||
}
|
||||
}
|
||||
|
||||
/// The verbosity settings for the cli.
|
||||
#[derive(Args)]
|
||||
#[command(next_help_heading = "Display")]
|
||||
struct Verbosity {
|
||||
pub struct Verbosity {
|
||||
/// Set the minimum log level.
|
||||
///
|
||||
/// -v Errors
|
||||
@ -150,7 +152,7 @@ struct Verbosity {
|
||||
impl Verbosity {
|
||||
/// Get the corresponding [Directive] for the given verbosity, or none if the verbosity
|
||||
/// corresponds to silent.
|
||||
fn directive(&self) -> Directive {
|
||||
pub fn directive(&self) -> Directive {
|
||||
if self.quiet {
|
||||
LevelFilter::OFF.into()
|
||||
} else {
|
||||
|
||||
@ -116,7 +116,8 @@ impl XdgPath for LogsDir {
|
||||
|
||||
/// A small helper trait for unit structs that represent a standard path following the XDG
|
||||
/// path specification.
|
||||
trait XdgPath {
|
||||
pub trait XdgPath {
|
||||
/// Resolve the standard path.
|
||||
fn resolve() -> Option<PathBuf>;
|
||||
}
|
||||
|
||||
|
||||
@ -236,9 +236,12 @@ where
|
||||
|
||||
/// Represents a gap to sync: from `local_head` to `target`
|
||||
#[derive(Debug)]
|
||||
struct SyncGap {
|
||||
local_head: SealedHeader,
|
||||
target: SyncTarget,
|
||||
pub struct SyncGap {
|
||||
/// The local head block. Represents lower bound of sync range.
|
||||
pub local_head: SealedHeader,
|
||||
|
||||
/// The sync target. Represents upper bound of sync range.
|
||||
pub target: SyncTarget,
|
||||
}
|
||||
|
||||
// === impl SyncGap ===
|
||||
@ -246,7 +249,7 @@ struct SyncGap {
|
||||
impl SyncGap {
|
||||
/// Returns `true` if the gap from the head to the target was closed
|
||||
#[inline]
|
||||
fn is_closed(&self) -> bool {
|
||||
pub fn is_closed(&self) -> bool {
|
||||
self.local_head.hash() == self.target.tip()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user