chiark / gitweb /
wip timestamp_abbreviate
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 26 Nov 2020 21:35:57 +0000 (21:35 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 26 Nov 2020 21:35:57 +0000 (21:35 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
wasm/wasm.rs
zcoord/misc.rs
zcoord/zcoord.rs

index 5e7d634177f38398a1d4a8506afe39b4f291208f..f7e03a9ae50e2b4b801f7081eabe9ae8d5d5e226 100644 (file)
@@ -89,6 +89,11 @@ impl ZCoordIterator {
   }
 }
 
+#[wasm_bindgen]
+pub fn timestring_abbreviate(base: &str, now: &str) -> JsString {
+  zcoord::misc::timestring_abbreviate(base,now).0.into()
+}
+
 #[wasm_bindgen]
 pub fn setup(s: &str) -> JsString {
   // returning String produces a wasm-opt error, as here
index 43531cc90ef9cc909f731b8f0d729cd89695521c..241529357df52b0aa1bc3269e20352eb881b54d2 100644 (file)
@@ -8,7 +8,9 @@
 use if_chain::if_chain;
 use arrayvec::ArrayVec;
 
-pub fn timesting_abbreviate<'x>(base: &str, this: &'x str) -> (&'x str, bool) {
+pub fn timestring_abbreviate<'x>(base: &str, this: &'x str)
+                                 -> (&'x str, bool)
+{
   fn split(s: &str) -> ArrayVec<[&str; 3]> {
     s.splitn(3, ' ').collect()
   }
index bab9cfd04c850ad41260195a4cf2a54cf7333509..5c156b792a9c6cbeefd71fc29191295749c38e6a 100644 (file)
@@ -79,7 +79,7 @@ use thiserror::Error;
 use serde_with::DeserializeFromStr;
 use serde_with::SerializeDisplay;
 
-mod misc;
+pub mod misc;
 
 //---------- core definitions ----------