mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-04-01 01:25:36 +00:00
show bytes as description, implement format bytes trait
This commit is contained in:
parent
d05b15c7a3
commit
f49ed0e11b
5 changed files with 66 additions and 13 deletions
|
|
@ -6,16 +6,18 @@ const NAME_MAX_LEN: usize = 125; // + 3 bytes for `...` offset @TODO optional
|
|||
pub struct Value {
|
||||
pub time: DateTime<Utc>,
|
||||
pub node: u64,
|
||||
/// Isolate by applying internal filter on value set
|
||||
// Isolate by applying internal filter on value set
|
||||
length: Option<u64>,
|
||||
name: Option<String>,
|
||||
}
|
||||
|
||||
impl Value {
|
||||
/// Create new `Self` with current timestamp
|
||||
pub fn new(node: u64, name: Option<String>) -> Self {
|
||||
pub fn new(node: u64, name: Option<String>, length: Option<u64>) -> Self {
|
||||
Self {
|
||||
time: Utc::now(),
|
||||
node,
|
||||
length,
|
||||
name: filter_name(name),
|
||||
}
|
||||
}
|
||||
|
|
@ -23,6 +25,10 @@ impl Value {
|
|||
pub fn name(&self) -> Option<&String> {
|
||||
self.name.as_ref()
|
||||
}
|
||||
/// Get reference to the safely constructed `length` member
|
||||
pub fn length(&self) -> Option<u64> {
|
||||
self.length
|
||||
}
|
||||
}
|
||||
|
||||
/// Prevent unexpected memory usage on store values from unknown source
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue