mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-28 21:50:26 +08:00
The `localtime` crate was defined by cloudhead, and is a minimal repository with a single `lib.rs`. Instead of using it as an external dependency, copy the code directly into a new workspace crate `radicle-localtime`. The default `serde` implementation goes through the `LocalTime`'s seconds values rather than milliseconds, since this is the more common format. This allows the removal of the `serde_ext` functions. The one place milliseconds was used was for the `radicle::cob::common::Timestamp` type, where the `Serialize` and `Deserialize` implementations are manually written. It also adds a `schemars` feature to remove `schemars_ext` functions in `radicle` as well.
59 lines
1.7 KiB
Rust
59 lines
1.7 KiB
Rust
// N.b. Rust 1.85 introduced some annoying clippy warnings about using `b""`
|
|
// syntax in place of `b''`, but in our cases they were u8 and not [u8] so the
|
|
// suggestions did not make sense.
|
|
#![allow(clippy::byte_char_slices)]
|
|
|
|
pub mod fingerprint;
|
|
pub mod reactor;
|
|
pub mod runtime;
|
|
|
|
mod control;
|
|
pub(crate) use radicle_protocol::service;
|
|
mod wire;
|
|
mod worker;
|
|
|
|
#[cfg(any(test, feature = "test"))]
|
|
pub mod test;
|
|
#[cfg(test)]
|
|
pub mod tests;
|
|
|
|
extern crate radicle_localtime as localtime;
|
|
|
|
use std::str::FromStr;
|
|
use std::sync::LazyLock;
|
|
|
|
use radicle::version::Version;
|
|
|
|
pub use localtime::{LocalDuration, LocalTime};
|
|
pub use radicle::node::Link;
|
|
pub use radicle::node::UserAgent;
|
|
pub use radicle::node::PROTOCOL_VERSION;
|
|
pub use radicle::prelude::Timestamp;
|
|
pub use radicle::{collections, crypto, git, identity, node, profile, rad, storage};
|
|
pub use runtime::Runtime;
|
|
|
|
/// Node version.
|
|
pub const VERSION: Version = Version {
|
|
name: env!("CARGO_PKG_NAME"),
|
|
commit: env!("GIT_HEAD"),
|
|
version: env!("RADICLE_VERSION"),
|
|
timestamp: env!("SOURCE_DATE_EPOCH"),
|
|
};
|
|
|
|
/// This node's user agent string.
|
|
pub static USER_AGENT: LazyLock<UserAgent> = LazyLock::new(|| {
|
|
FromStr::from_str(format!("/radicle:{}/", VERSION.version).as_str())
|
|
.expect("user agent is valid")
|
|
});
|
|
|
|
pub mod prelude {
|
|
pub use crate::crypto::{PublicKey, Signature};
|
|
pub use crate::identity::{Did, RepoId};
|
|
pub use crate::node::{config::Network, Address, Event, NodeId};
|
|
pub use crate::service::filter::Filter;
|
|
pub use crate::service::{DisconnectReason, Message};
|
|
pub use crate::storage::refs::Refs;
|
|
pub use crate::storage::WriteStorage;
|
|
pub use crate::{LocalDuration, LocalTime, Timestamp};
|
|
}
|