diff --git a/help.html b/help.html index 4a2f4a5..84c2032 100644 --- a/help.html +++ b/help.html @@ -1,2 +1 @@ -
NTP64
(in bits)","An Hybric Logical Clock generating Timestamp
s","The builder of HLC
.","An identifier for an HLC (MAX_SIZE bytes maximum). This …","The maximum size of an le-encoded ID
in bytes: 16.","A NTP 64-bits format as specified in RFC-5909","","","","","A timestamp made of a NTP64
and a crate::HLC
’s unique …","","","","","","","Returns the 32-bits seconds part.","Returns this NTP64 as a f64 in seconds.","Returns this NTP64 as a u64.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Create a new HLC
with a random u128 ID and using …","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","Returns the HLC delta as NTP64
.","","Returns the HLC ID
.","","","","","","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Constructs a new HLCBuilder for the creation of an HLC
, …","","Generate a new Timestamp
.","","","","Generate a random ID
.","","","","The size of this ID
in bytes. I.e., the number of …","","","","","","","Returns the 32-bits fraction of second part converted to …","A physical clock relying on std::time::SystemTime::now().","Convert to a Duration
.","This ID as bytes","","","","","","","","","","","","Convert to a SystemTime
(making the assumption that this …","","","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","Performs the conversion. NOTE: the bytes slice is …","","","","","","","","","","","","","","","","","","","","","","","","","Update this HLC
with a Timestamp
.","","","","","","","","","","Configure a specific physical clock for the HLC to be …","Configure a specific identifier for the HLC to be created.","Configure the maximum delta accepted by an HLC when …","A dummy clock that returns a NTP64 initialized with the …"],"i":[0,0,0,0,8,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,6,7,8,9,10,1,11,12,13,6,7,8,9,10,1,11,12,13,6,10,11,13,8,9,10,1,11,12,13,8,9,10,1,11,12,13,8,1,12,6,7,1,8,1,12,8,10,1,11,12,13,8,8,9,9,10,1,1,11,12,12,13,6,7,8,8,8,8,8,8,9,10,1,1,11,12,13,8,1,12,7,12,7,12,12,8,1,12,6,7,8,9,10,1,11,12,13,6,12,7,8,1,12,8,8,1,12,8,1,1,1,1,1,1,1,0,1,8,8,9,10,1,11,12,13,8,9,1,12,1,6,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,10,1,11,12,13,6,7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",0],[1,"u64"],[1,"unit"],[1,"u32"],[1,"f64"],[5,"HLCBuilder",0],[5,"HLC",0],[5,"ID",0],[5,"SizeError",0],[5,"ParseIDError",0],[5,"ParseNTP64Error",0],[5,"Timestamp",0],[5,"ParseTimestampError",0],[6,"Ordering",229],[6,"Result",230],[10,"Deserializer",231],[1,"bool"],[5,"Formatter",232],[8,"Result",232],[8,"NonZeroU32",233],[8,"NonZeroU8",233],[8,"NonZeroU128",233],[8,"NonZeroU16",233],[8,"NonZeroU64",233],[5,"Duration",234],[1,"str"],[10,"Hasher",235],[6,"Option",236],[10,"Serializer",237],[1,"usize"],[1,"u8"],[1,"array"],[5,"String",238],[5,"SystemTime",239],[1,"u16"],[1,"u128"],[1,"slice"],[5,"TypeId",240]],"b":[[11,"impl-Add%3CNTP64%3E-for-%26NTP64"],[12,"impl-Add%3C%26NTP64%3E-for-%26NTP64"],[13,"impl-Add%3C%26NTP64%3E-for-NTP64"],[14,"impl-Add%3Cu64%3E-for-NTP64"],[15,"impl-Add-for-NTP64"],[71,"impl-Display-for-ID"],[72,"impl-Debug-for-ID"],[73,"impl-Debug-for-SizeError"],[74,"impl-Display-for-SizeError"],[76,"impl-Display-for-NTP64"],[77,"impl-Debug-for-NTP64"],[79,"impl-Display-for-Timestamp"],[80,"impl-Debug-for-Timestamp"],[85,"impl-From%3CNonZero%3Cu32%3E%3E-for-ID"],[86,"impl-From%3CNonZero%3Cu8%3E%3E-for-ID"],[87,"impl-From%3CNonZero%3Cu128%3E%3E-for-ID"],[88,"impl-From%3CNonZero%3Cu16%3E%3E-for-ID"],[89,"impl-From%3CNonZero%3Cu64%3E%3E-for-ID"],[128,"impl-Sub%3CNTP64%3E-for-%26NTP64"],[129,"impl-Sub-for-NTP64"],[130,"impl-Sub%3Cu64%3E-for-NTP64"],[131,"impl-Sub%3C%26NTP64%3E-for-%26NTP64"],[132,"impl-Sub%3C%26NTP64%3E-for-NTP64"],[152,"impl-TryFrom%3C%26%5Bu8;+7%5D%3E-for-ID"],[153,"impl-TryFrom%3C%26%5Bu8;+5%5D%3E-for-ID"],[154,"impl-TryFrom%3C%5Bu8;+8%5D%3E-for-ID"],[155,"impl-TryFrom%3C%26%5Bu8;+13%5D%3E-for-ID"],[156,"impl-TryFrom%3C%5Bu8;+5%5D%3E-for-ID"],[157,"impl-TryFrom%3C%26%5Bu8;+11%5D%3E-for-ID"],[158,"impl-TryFrom%3C%5Bu8;+4%5D%3E-for-ID"],[159,"impl-TryFrom%3C%5Bu8;+11%5D%3E-for-ID"],[160,"impl-TryFrom%3C%5Bu8;+16%5D%3E-for-ID"],[161,"impl-TryFrom%3C%5Bu8;+14%5D%3E-for-ID"],[162,"impl-TryFrom%3C%5Bu8;+3%5D%3E-for-ID"],[163,"impl-TryFrom%3C%5Bu8;+2%5D%3E-for-ID"],[164,"impl-TryFrom%3C%26%5Bu8;+15%5D%3E-for-ID"],[165,"impl-TryFrom%3C%5Bu8;+7%5D%3E-for-ID"],[166,"impl-TryFrom%3Cu16%3E-for-ID"],[167,"impl-TryFrom%3C%26%5Bu8;+1%5D%3E-for-ID"],[168,"impl-TryFrom%3C%26%5Bu8;+10%5D%3E-for-ID"],[169,"impl-TryFrom%3C%26%5Bu8;+9%5D%3E-for-ID"],[170,"impl-TryFrom%3C%5Bu8;+13%5D%3E-for-ID"],[171,"impl-TryFrom%3C%26%5Bu8;+4%5D%3E-for-ID"],[172,"impl-TryFrom%3Cu128%3E-for-ID"],[173,"impl-TryFrom%3C%5Bu8;+9%5D%3E-for-ID"],[174,"impl-TryFrom%3C%26%5Bu8;+6%5D%3E-for-ID"],[176,"impl-TryFrom%3C%26%5Bu8;+8%5D%3E-for-ID"],[177,"impl-TryFrom%3C%26%5Bu8;+3%5D%3E-for-ID"],[178,"impl-TryFrom%3C%26%5Bu8;+12%5D%3E-for-ID"],[179,"impl-TryFrom%3C%5Bu8;+12%5D%3E-for-ID"],[180,"impl-TryFrom%3C%5Bu8;+1%5D%3E-for-ID"],[181,"impl-TryFrom%3Cu64%3E-for-ID"],[182,"impl-TryFrom%3C%5Bu8;+6%5D%3E-for-ID"],[183,"impl-TryFrom%3C%26%5Bu8%5D%3E-for-ID"],[184,"impl-TryFrom%3Cu32%3E-for-ID"],[185,"impl-TryFrom%3C%5Bu8;+15%5D%3E-for-ID"],[186,"impl-TryFrom%3C%26%5Bu8;+16%5D%3E-for-ID"],[187,"impl-TryFrom%3Cu8%3E-for-ID"],[188,"impl-TryFrom%3C%5Bu8;+10%5D%3E-for-ID"],[189,"impl-TryFrom%3C%26%5Bu8;+2%5D%3E-for-ID"],[190,"impl-TryFrom%3C%26%5Bu8;+14%5D%3E-for-ID"]]}]\
+["uhlc",{"t":"SFFFTFFFFFFNNNNNNNNNNNNNNNNNNNNNNNNNNNNOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNHNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNH","n":["CSIZE","HLC","HLCBuilder","ID","MAX_SIZE","NTP64","ParseIDError","ParseNTP64Error","ParseTimestampError","SizeError","Timestamp","add","add","add","add","add","add_assign","as_secs","as_secs_f64","as_u64","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","build","cause","cause","cause","clone","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","cmp","cmp","default","default","default","deserialize","deserialize","deserialize","eq","eq","eq","eq","eq","eq","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from_str","from_str","from_str","get_delta","get_diff_duration","get_id","get_id","get_time","hash","hash","hash","into","into","into","into","into","into","into","into","into","new","new","new_timestamp","parse_rfc3339","parse_rfc3339","partial_cmp","partial_cmp","partial_cmp","rand","serialize","serialize","serialize","size","sub","sub","sub","sub","sub","sub_assign","subsec_nanos","system_time_clock","to_duration","to_le_bytes","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","to_string","to_string","to_string","to_string_rfc3339_lossy","to_string_rfc3339_lossy","to_system_time","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","update_with_timestamp","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","with_clock","with_id","with_max_delta","zero_clock"],"q":[[0,"uhlc"],[233,"uhlc::ntp64"],[234,"uhlc::id"],[235,"uhlc::timestamp"],[236,"core::cmp"],[237,"core::result"],[238,"serde::de"],[239,"core::fmt"],[240,"core::num::nonzero"],[241,"core::time"],[242,"core::hash"],[243,"core::option"],[244,"serde::ser"],[245,"alloc::string"],[246,"std::time"],[247,"core::any"]],"i":[0,0,0,0,8,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,6,7,8,9,10,1,11,12,13,6,7,8,9,10,1,11,12,13,6,10,11,13,8,9,10,1,11,12,13,8,9,10,1,11,12,13,8,1,12,6,7,1,8,1,12,8,10,1,11,12,13,8,8,9,9,10,1,1,11,12,12,13,6,7,8,8,8,8,8,8,9,10,1,1,11,12,13,8,1,12,7,12,7,12,12,8,1,12,6,7,8,9,10,1,11,12,13,6,12,7,1,12,8,1,12,8,8,1,12,8,1,1,1,1,1,1,1,0,1,8,8,9,10,1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A`c}}}{}}222222222{Dh{{An{A`c}}}{}}333333335333333{h{{An{A`c}}}{}}{{{Dj{Cn}}}{{An{A`c}}}{}}777777777777777{cDl{}}00000000{{nAh}{{An{fDb}}}}>>>>>>>>>{{l{E`{}{{Dn{b}}}}}l}{{lA`}l}{{lCb}l}{{}b}","D":"Jj","p":[[5,"NTP64",0,233],[1,"u64"],[1,"unit"],[1,"u32"],[1,"f64"],[5,"HLCBuilder",0],[5,"HLC",0],[5,"ID",0,234],[5,"SizeError",0,234],[5,"ParseIDError",0,234],[5,"ParseNTP64Error",0,233],[5,"Timestamp",0,235],[5,"ParseTimestampError",0,235],[6,"Ordering",236],[6,"Result",237],[10,"Deserializer",238],[1,"bool"],[5,"Formatter",239],[8,"Result",239],[8,"NonZeroU32",240],[8,"NonZeroU16",240],[8,"NonZeroU128",240],[8,"NonZeroU64",240],[8,"NonZeroU8",240],[5,"Duration",241],[1,"str"],[10,"Hasher",242],[6,"Option",243],[10,"Serializer",244],[1,"usize"],[1,"u8"],[1,"array"],[5,"String",245],[5,"SystemTime",246],[1,"u16"],[1,"u128"],[1,"slice"],[5,"TypeId",247],[17,"Output"],[1,"fn"]],"r":[[3,234],[5,233],[6,234],[7,233],[8,235],[9,234],[10,235]],"b":[[11,"impl-Add%3Cu64%3E-for-NTP64"],[12,"impl-Add-for-NTP64"],[13,"impl-Add%3C%26NTP64%3E-for-NTP64"],[14,"impl-Add%3CNTP64%3E-for-%26NTP64"],[15,"impl-Add%3C%26NTP64%3E-for-%26NTP64"],[71,"impl-Display-for-ID"],[72,"impl-Debug-for-ID"],[73,"impl-Debug-for-SizeError"],[74,"impl-Display-for-SizeError"],[76,"impl-Debug-for-NTP64"],[77,"impl-Display-for-NTP64"],[79,"impl-Debug-for-Timestamp"],[80,"impl-Display-for-Timestamp"],[84,"impl-From%3CNonZero%3Cu32%3E%3E-for-ID"],[85,"impl-From%3CNonZero%3Cu16%3E%3E-for-ID"],[87,"impl-From%3CNonZero%3Cu128%3E%3E-for-ID"],[88,"impl-From%3CNonZero%3Cu64%3E%3E-for-ID"],[89,"impl-From%3CNonZero%3Cu8%3E%3E-for-ID"],[130,"impl-Sub-for-NTP64"],[131,"impl-Sub%3Cu64%3E-for-NTP64"],[132,"impl-Sub%3C%26NTP64%3E-for-%26NTP64"],[133,"impl-Sub%3CNTP64%3E-for-%26NTP64"],[134,"impl-Sub%3C%26NTP64%3E-for-NTP64"],[156,"impl-TryFrom%3Cu8%3E-for-ID"],[157,"impl-TryFrom%3C%5Bu8;+3%5D%3E-for-ID"],[158,"impl-TryFrom%3C%26%5Bu8;+1%5D%3E-for-ID"],[159,"impl-TryFrom%3C%26%5Bu8;+5%5D%3E-for-ID"],[160,"impl-TryFrom%3C%5Bu8;+11%5D%3E-for-ID"],[161,"impl-TryFrom%3C%26%5Bu8;+16%5D%3E-for-ID"],[162,"impl-TryFrom%3C%5Bu8;+14%5D%3E-for-ID"],[163,"impl-TryFrom%3C%26%5Bu8;+14%5D%3E-for-ID"],[164,"impl-TryFrom%3C%5Bu8;+16%5D%3E-for-ID"],[165,"impl-TryFrom%3C%5Bu8;+8%5D%3E-for-ID"],[166,"impl-TryFrom%3Cu64%3E-for-ID"],[167,"impl-TryFrom%3Cu16%3E-for-ID"],[168,"impl-TryFrom%3C%26%5Bu8;+15%5D%3E-for-ID"],[169,"impl-TryFrom%3C%5Bu8;+2%5D%3E-for-ID"],[170,"impl-TryFrom%3C%26%5Bu8;+8%5D%3E-for-ID"],[171,"impl-TryFrom%3C%5Bu8;+10%5D%3E-for-ID"],[172,"impl-TryFrom%3C%26%5Bu8;+10%5D%3E-for-ID"],[173,"impl-TryFrom%3C%26%5Bu8;+9%5D%3E-for-ID"],[174,"impl-TryFrom%3C%26%5Bu8;+6%5D%3E-for-ID"],[175,"impl-TryFrom%3C%5Bu8;+4%5D%3E-for-ID"],[176,"impl-TryFrom%3C%5Bu8;+7%5D%3E-for-ID"],[177,"impl-TryFrom%3Cu128%3E-for-ID"],[178,"impl-TryFrom%3C%26%5Bu8;+13%5D%3E-for-ID"],[179,"impl-TryFrom%3C%26%5Bu8;+11%5D%3E-for-ID"],[180,"impl-TryFrom%3C%5Bu8;+5%5D%3E-for-ID"],[181,"impl-TryFrom%3C%26%5Bu8;+7%5D%3E-for-ID"],[182,"impl-TryFrom%3C%5Bu8;+12%5D%3E-for-ID"],[183,"impl-TryFrom%3C%5Bu8;+6%5D%3E-for-ID"],[184,"impl-TryFrom%3C%26%5Bu8;+12%5D%3E-for-ID"],[185,"impl-TryFrom%3C%5Bu8;+9%5D%3E-for-ID"],[187,"impl-TryFrom%3C%5Bu8;+15%5D%3E-for-ID"],[188,"impl-TryFrom%3C%26%5Bu8;+3%5D%3E-for-ID"],[189,"impl-TryFrom%3C%26%5Bu8;+2%5D%3E-for-ID"],[190,"impl-TryFrom%3C%5Bu8;+13%5D%3E-for-ID"],[191,"impl-TryFrom%3C%26%5Bu8;+4%5D%3E-for-ID"],[192,"impl-TryFrom%3C%5Bu8;+1%5D%3E-for-ID"],[193,"impl-TryFrom%3Cu32%3E-for-ID"],[194,"impl-TryFrom%3C%26%5Bu8%5D%3E-for-ID"]],"c":"OjAAAAAAAAA=","e":"OzAAAAEAAJQAGAAHAAMADAAFABUAJwA+AA8ATwABAFIAAABVAAEAWAACAF4AAABiAAIAZgAAAGgABAB3AAAAewACAH8AAgCDAAUAjQAKAJsAAgCnAAEAsgAAALsAAADCAAAAxAAXAN0ACAA="}]\
]'));
if (typeof exports !== 'undefined') exports.searchIndex = searchIndex;
else if (window.initSearch) window.initSearch(searchIndex);
diff --git a/search.desc/uhlc/uhlc-desc-0-.js b/search.desc/uhlc/uhlc-desc-0-.js
new file mode 100644
index 0000000..94ef25f
--- /dev/null
+++ b/search.desc/uhlc/uhlc-desc-0-.js
@@ -0,0 +1 @@
+searchState.loadedDescShard("uhlc", 0, "A Unique Hybrid Logical Clock.\nThe size of counter part in NTP64
(in bits)\nAn Hybric Logical Clock generating Timestamp
s\nThe builder of HLC
.\nAn identifier for an HLC (MAX_SIZE bytes maximum). This …\nThe maximum size of an le-encoded ID
in bytes: 16.\nA NTP 64-bits format as specified in RFC-5909\nA timestamp made of a NTP64
and a crate::HLC
’s unique …\nReturns the 32-bits seconds part.\nReturns this NTP64 as a f64 in seconds.\nReturns this NTP64 as a u64.\nCreate a new HLC
with a random u128 ID and using …\nBy default formats the value as an unsigned integer in …\nFormats Timestamp as the time part followed by the ID …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the HLC delta as NTP64
.\nReturns the HLC ID
.\nCalls U::from(self)
.\nCalls U::from(self)
.\nCalls U::from(self)
.\nCalls U::from(self)
.\nCalls U::from(self)
.\nCalls U::from(self)
.\nCalls U::from(self)
.\nCalls U::from(self)
.\nCalls U::from(self)
.\nConstructs a new HLCBuilder for the creation of an HLC
, …\nGenerate a new Timestamp
.\nParse a RFC3339 time representation into a NTP64.\nParse a RFC3339 time representation into a NTP64.\nGenerate a random ID
.\nThe size of this ID
in bytes. I.e., the number of …\nReturns the 32-bits fraction of second part converted to …\nA physical clock relying on std::time::SystemTime::now().\nConvert to a Duration
.\nThis ID as bytes\nConvert to a RFC3339 time representation with nanoseconds …\nConvert to a RFC3339 time representation with nanoseconds …\nConvert to a SystemTime
(making the assumption that this …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nPerforms the conversion. NOTE: the bytes slice is …\nUpdate this HLC
with a Timestamp
.\nConfigure a specific physical clock for the HLC to be …\nConfigure a specific identifier for the HLC to be created.\nConfigure the maximum delta accepted by an HLC when …\nA dummy clock that returns a NTP64 initialized with the …")
\ No newline at end of file
diff --git a/settings.html b/settings.html
index 27fcabf..1e7c348 100644
--- a/settings.html
+++ b/settings.html
@@ -1,2 +1 @@
-1 +id.rs - source #[cfg(feature = "std")] impl std::error::Error for SizeError {} -macro_rules! impl_from_sized_slice_for_id { +macro_rules! impl_from_sized_slice_for_id { ($N: expr) => { impl TryFrom<&[u8; $N]> for ID { type Error = SizeError; diff --git a/src/uhlc/lib.rs.html b/src/uhlc/lib.rs.html index e4490e6..3545e23 100644 --- a/src/uhlc/lib.rs.html +++ b/src/uhlc/lib.rs.html @@ -1,6 +1,4 @@ -pub fn to_system_time(self) -> SystemTime { UNIX_EPOCH + self.to_duration() } + + /// Convert to a RFC3339 time representation with nanoseconds precision. + /// e.g.: `"2024-07-01T13:51:12.129693000Z"`` + #[cfg(feature = "std")] + pub fn to_string_rfc3339_lossy(&self) -> String { + format_rfc3339_nanos(self.to_system_time()).to_string() + } + + /// Parse a RFC3339 time representation into a NTP64. + #[cfg(feature = "std")] + pub fn parse_rfc3339(s: &str) -> Result<Self, ParseNTP64Error> { + match humantime::parse_rfc3339(s) { + Ok(time) => time + .duration_since(UNIX_EPOCH) + .map(NTP64::from) + .map_err(|e| ParseNTP64Error { + cause: format!("Failed to parse '{s}' : {e}"), + }), + Err(_) => Err(ParseNTP64Error { + cause: format!("Failed to parse '{s}' : invalid RFC3339 format"), + }), + } + } } impl Add for NTP64 { @@ -492,17 +605,33 @@lib.rs - source - let msg_time = timestamp.get_time(); if *msg_time > now && *msg_time - now > self.delta { let err_msg = format!( - "incoming timestamp from {} exceeding delta {}ms is rejected: {} vs. now: {}", + "incoming timestamp from {} exceeding delta {}ms is rejected: {:#} vs. now: {:#}", timestamp.get_id(), self.delta.to_duration().as_millis(), msg_time, diff --git a/src/uhlc/ntp64.rs.html b/src/uhlc/ntp64.rs.html index becde93..ff18f1d 100644 --- a/src/uhlc/ntp64.rs.html +++ b/src/uhlc/ntp64.rs.html @@ -1,6 +1,4 @@ -} #[cfg(not(feature = "std"))] -macro_rules! lock { +macro_rules! lock { ($var:expr) => { $var.lock() }; @@ -773,7 +771,7 @@1 +lib.rs - source // I.e.: if an incoming timestamp has a time > now() + delta, then the HLC is not updated. const DEFAULT_DELTA_MS: u64 = 500; #[cfg(feature = "std")] -lazy_static! { +lazy_static! { static ref DELTA_MS: u64 = match var("UHLC_MAX_DELTA_MS") { Ok(s) => s.parse().unwrap_or_else(|e| panic!( "Error parsing environment variable ${{UHLC_MAX_DELTA_MS}}={} : {}", @@ -680,7 +678,7 @@} #[cfg(feature = "std")] -macro_rules! lock { +macro_rules! lock { ($var:expr) => { match $var.try_lock() { Ok(guard) => guard, @@ -690,7 +688,7 @@Files
Files
Files
ntp64.rs - source - /// and the 2nd 32-bits part is the fraction of second. /// In case it's part of a [`crate::Timestamp`] generated by an [`crate::HLC`] the last few bits /// of the Fraction part are replaced by the HLC logical counter. -/// The size of this counter currently hard-coded as [`crate::CSIZE`]. +/// The size of this counter is currently hard-coded as [`crate::CSIZE`]. /// -/// Note that this timestamp in actually similar to a [`std::time::Duration`], as it doesn't -/// define an EPOCH. Only the [`NTP64::to_system_time()`] and [`std::fmt::Display::fmt()`] operations assume that -/// it's relative to UNIX_EPOCH (1st Jan 1970) to display the timpestamp in RFC-3339 format. +/// ## Conversion to/from String +/// 2 different String representations are supported: +/// 1. **as an unsigned integer in decimal format** +/// - Such conversion is lossless and thus bijective. +/// - NTP64 to String: use [`std::fmt::Display::fmt()`] or [`std::string::ToString::to_string()`]. +/// - String to NTP64: use [`std::str::FromStr::from_str()`] +/// 2. **as a [RFC3339](https://www.rfc-editor.org/rfc/rfc3339.html#section-5.8) (human readable) format**: +/// - Such conversion loses some precision because of rounding when conferting the fraction part to nanoseconds +/// - As a consequence it's not bijective: a NTP64 converted to RFC3339 String and then converted back to NTP64 might result to a different time. +/// - NTP64 to String: use [`std::fmt::Display::fmt()`] with the alternate flag (`{:#}`) or [`NTP64::to_string_rfc3339_lossy()`]. +/// - String to NTP64: use [`NTP64::parse_rfc3339()`] +/// +/// ## On EPOCH +/// This timestamp in actually similar to a [`std::time::Duration`], as it doesn't define an EPOCH. +/// Only [`NTP64::to_system_time()`], [`NTP64::to_string_rfc3339_lossy()`] and [`std::fmt::Display::fmt()`] (when using `{:#}` alternate flag) +/// operations assume that it's relative to UNIX_EPOCH (1st Jan 1970) to display the timestamp in RFC-3339 format. #[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Default, Deserialize, Serialize)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct NTP64(pub u64); @@ -385,6 +475,29 @@#[cfg(feature = "std")] use { core::str::FromStr, - humantime::{format_rfc3339_nanos, parse_rfc3339}, + humantime::format_rfc3339_nanos, std::time::{SystemTime, UNIX_EPOCH}, }; @@ -331,11 +408,24 @@1 +ntp64.rs - source 279 280 281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360// // Copyright (c) 2017, 2020 ADLINK Technology Inc. // @@ -300,7 +377,7 @@
Files
Files
Files
Files
1 +timestamp.rs - source 144 145 146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216// // Copyright (c) 2017, 2020 ADLINK Technology Inc. // @@ -165,6 +233,19 @@
Files
fn:
) to \
+ restrict the search to a given item kind.","Accepted kinds are: fn
, mod
, struct
, \
+ enum
, trait
, type
, macro
, \
+ and const
.","Search functions by type signature (e.g., vec -> usize
or \
+ -> vec
or String, enum:Cow -> bool
)","You can look for items with an exact name by putting double quotes around \
+ your request: \"string\"
","Look for functions that accept or return \
+ slices and \
+ arrays by writing \
+ square brackets (e.g., -> [u8]
or [] -> Option
)","Look for items inside another one by searching for a path: vec::Vec
",].map(x=>""+x+"
").join("");const div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="fn:
) to \
- restrict the search to a given item kind.","Accepted kinds are: fn
, mod
, struct
, \
- enum
, trait
, type
, macro
, \
- and const
.","Search functions by type signature (e.g., vec -> usize
or \
- -> vec
or String, enum:Cow -> bool
)","You can look for items with an exact name by putting double quotes around \
- your request: \"string\"
","Look for functions that accept or return \
- slices and \
- arrays by writing \
- square brackets (e.g., -> [u8]
or [] -> Option
)","Look for items inside another one by searching for a path: vec::Vec
",].map(x=>""+x+"
").join("");const div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="${value.replaceAll(" ", " ")}
`}else{error[index]=value}});output+=`${value.replaceAll(" ", " ")}
`}else{error[index]=value}});output+=`pub const CSIZE: u8 = 4u8;
The size of counter part in NTP64
(in bits)
pub fn system_time_clock() -> NTP64
A physical clock relying on std::time::SystemTime::now().
+pub fn system_time_clock() -> NTP64
A physical clock relying on std::time::SystemTime::now().
It returns a NTP64 relative to std::time::UNIX_EPOCH (1st Jan 1970).
That’s the default clock used by an HLC
if HLCBuilder::with_clock()
is not called.
pub fn zero_clock() -> NTP64
A dummy clock that returns a NTP64 initialized with the value 0. +
pub fn zero_clock() -> NTP64
A dummy clock that returns a NTP64 initialized with the value 0.
Suitable to use in no_std environments where std::time::{SystemTime, UNIX_EPOCH} are not available.
If the feature std
is disabled, that’s the default clock used by an HLC
if HLCBuilder::with_clock()
is not called.
Notice that this means that the HLC
will use incremental timestamps starting from 0.
A Unique Hybrid Logical Clock.
+A Unique Hybrid Logical Clock.
This library is an implementation of an Hybrid Logical Clock (HLC) associated to a unique identifier. diff --git a/uhlc/struct.HLC.html b/uhlc/struct.HLC.html index 2b1070c..9d734e1 100644 --- a/uhlc/struct.HLC.html +++ b/uhlc/struct.HLC.html @@ -1,5 +1,4 @@ -
pub struct HLC { /* private fields */ }
An Hybric Logical Clock generating Timestamp
s
pub struct HLC { /* private fields */ }
An Hybric Logical Clock generating Timestamp
s
Returns the HLC delta as NTP64
.
The maximum delta accepted by an HLC when updating it’s logical clock calling HLC::update_with_timestamp()
.
Update this HLC
with a Timestamp
.
Typically, this timestamp should have been generated by another HLC.
If the timestamp exceeds the current time of this HLC by more than the configured maximum delta
-(see HLCBuilder::with_max_delta()
) an Err
is returned.
HLCBuilder::with_max_delta()
) an Err
is returned.
use uhlc::HLC;
@@ -36,18 +35,18 @@ §Examples
let ts = hlc1.new_timestamp();
assert!(ts > other_ts);
pub struct HLCBuilder { /* private fields */ }
The builder of HLC
.
pub struct HLCBuilder { /* private fields */ }
The builder of HLC
.
use std::{convert::TryFrom, time::Duration};
use uhlc::{HLCBuilder, ID};
@@ -23,20 +22,20 @@ §Examples
Configure a specific identifier for the HLC to be created.
NOTE: the identifier must be unique in the system.
-Configure a specific physical clock for the HLC to be created.
+Configure a specific physical clock for the HLC to be created.
The clock
parameter must be a function returning a new physical time (as an NTP64
at each call.
The time returned by this clock doesn’t need to be monotonic: when the HLC generates a new timestamp from this time,
it first checks if this time is greater than the previously generated timestamp. If not, the new timestamp it the previous one +1.
Configure the maximum delta accepted by an HLC when updating it’s logical clock calling HLC::update_with_timestamp()
.
Configure the maximum delta accepted by an HLC when updating it’s logical clock calling HLC::update_with_timestamp()
.
pub struct ID(/* private fields */);
An identifier for an HLC (MAX_SIZE bytes maximum). +
pub struct ID(/* private fields */);
This ID as bytes
+self
and other
) and is used by the <=
-operator. Read moreself
and other
) and is used by the <=
+operator. Read moreFrom<T> for U
chooses to do.
+pub struct NTP64(pub u64);
A NTP 64-bits format as specified in +
pub struct NTP64(pub u64);
A NTP 64-bits format as specified in RFC-5909
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@@ -13,43 +12,74 @@
and the 2nd 32-bits part is the fraction of second.
In case it’s part of a crate::Timestamp
generated by an crate::HLC
the last few bits
of the Fraction part are replaced by the HLC logical counter.
-The size of this counter currently hard-coded as crate::CSIZE
.
-Note that this timestamp in actually similar to a std::time::Duration
, as it doesn’t
-define an EPOCH. Only the NTP64::to_system_time()
and std::fmt::Display::fmt()
operations assume that
-it’s relative to UNIX_EPOCH (1st Jan 1970) to display the timpestamp in RFC-3339 format.
-
0: u64
Returns this NTP64 as a f64 in seconds.
+The size of this counter is currently hard-coded ascrate::CSIZE
.
+2 different String representations are supported:
+std::fmt::Display::fmt()
or std::string::ToString::to_string()
.std::str::FromStr::from_str()
std::fmt::Display::fmt()
with the alternate flag ({:#}
) or NTP64::to_string_rfc3339_lossy()
.NTP64::parse_rfc3339()
This timestamp in actually similar to a std::time::Duration
, as it doesn’t define an EPOCH.
+Only NTP64::to_system_time()
, NTP64::to_string_rfc3339_lossy()
and std::fmt::Display::fmt()
(when using {:#}
alternate flag)
+operations assume that it’s relative to UNIX_EPOCH (1st Jan 1970) to display the timestamp in RFC-3339 format.
0: u64
Returns this NTP64 as a f64 in seconds.
The integer part of the f64 is the NTP64’s Seconds part.
The decimal part of the f64 is the result of a division of NTP64’s Fraction part divided by 2^32.
Considering the probable large number of Seconds (for a time relative to UNIX_EPOCH), the precision of the resulting f64 might be in the order of microseconds.
Therefore, it should not be used for comparison. Directly comparing NTP64 objects is preferable.
Returns the 32-bits fraction of second part converted to nanoseconds.
-Convert to a Duration
.
Convert to a SystemTime
(making the assumption that this NTP64 is relative to UNIX_EPOCH
).
+=
operation. Read moreself
and other
) and is used by the <=
-operator. Read more-=
operation. Read moreReturns the 32-bits fraction of second part converted to nanoseconds.
+Convert to a Duration
.
Convert to a SystemTime
(making the assumption that this NTP64 is relative to UNIX_EPOCH
).
Convert to a RFC3339 time representation with nanoseconds precision. +e.g.: `“2024-07-01T13:51:12.129693000Z”``
+Parse a RFC3339 time representation into a NTP64.
++=
operation. Read moreBy default formats the value as an unsigned integer in decimal format.
+If the alternate flag {:#}
is used, formats the value with RFC3339 representation with nanoseconds precision.
use uhlc::NTP64;
+
+ let t = NTP64(7386690599959157260);
+ println!("{t}"); // displays: 7386690599959157260
+ println!("{t:#}"); // displays: 2024-07-01T15:32:06.860479000Z
self
and other
) and is used by the <=
+operator. Read more-=
operation. Read moreFrom<T> for U
chooses to do.
+pub struct ParseIDError {
- pub cause: String,
-}
cause: String
source
. Read moreself
and other
values to be equal, and is used
-by ==
.Calls U::from(self)
.
pub struct ParseIDError {
+ pub cause: String,
+}
cause: String
source
. Read moreself
and other
values to be equal, and is used
+by ==
.pub struct ParseNTP64Error {
- pub cause: String,
-}
cause: String
source
. Read moreself
and other
values to be equal, and is used
-by ==
.Calls U::from(self)
.
pub struct ParseNTP64Error {
+ pub cause: String,
+}
cause: String
source
. Read moreself
and other
values to be equal, and is used
+by ==
.pub struct ParseTimestampError {
- pub cause: String,
-}
cause: String
source
. Read moreself
and other
values to be equal, and is used
-by ==
.Calls U::from(self)
.
pub struct ParseTimestampError {
+ pub cause: String,
+}
cause: String
source
. Read moreself
and other
values to be equal, and is used
+by ==
.pub struct SizeError(pub usize);
0: usize
Calls U::from(self)
.
pub struct SizeError(pub usize);
0: usize
pub struct Timestamp { /* private fields */ }
A timestamp made of a NTP64
and a crate::HLC
’s unique identifier.
self
and other
) and is used by the <=
-operator. Read moreCalls U::from(self)
.
pub struct Timestamp { /* private fields */ }
A timestamp made of a NTP64
and a crate::HLC
’s unique identifier.
A Timestamp is formatted to a String as such: "<ntp64_time>/<hlc_id_hexadecimal>"
+2 different String representations are supported:
<ntp64_time>
as an unsigned integer in decimal formatstd::fmt::Display::fmt()
or std::string::ToString::to_string()
.std::str::FromStr::from_str()
<ntp64_time>
as a RFC3339 (human readable) format:std::fmt::Display::fmt()
with the alternate flag ({:#}
) or Timestamp::to_string_rfc3339_lossy()
.Timestamp::parse_rfc3339()
Convert to a RFC3339 time representation with nanoseconds precision. +e.g.: `“2024-07-01T13:51:12.129693000Z/33”``
+Parse a RFC3339 time representation into a NTP64.
+Formats Timestamp as the time part followed by the ID part, with /
as separator.
+By default the time part is formatted as an unsigned integer in decimal format.
+If the alternate flag {:#}
is used, the time part is formatted with RFC3339 representation with nanoseconds precision.
use uhlc::*;
+ use std::convert::TryFrom;
+
+ let t =Timestamp::new(NTP64(7386690599959157260), ID::try_from([0x33]).unwrap());
+ println!("{t}"); // displays: 7386690599959157260/33
+ println!("{t:#}"); // displays: 2024-07-01T15:32:06.860479000Z/33
self
and other
) and is used by the <=
+operator. Read moreFrom<T> for U
chooses to do.
+