diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-05-31 13:31:52 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-05-31 18:03:26 +0200 |
commit | 33a2c03ea8361ae61c162e307e10bc7266c1b249 (patch) | |
tree | 30bdf5c653789d800e1013616b7fab56f78a080a | |
parent | cd5dbbe1656de505eb93df389429bbe21c36b912 (diff) |
handlebars: 2 -> 3
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | bin/core/imag-view/Cargo.toml | 2 | ||||
-rw-r--r-- | bin/domain/imag-bookmark/Cargo.toml | 2 | ||||
-rw-r--r-- | bin/domain/imag-calendar/Cargo.toml | 2 | ||||
-rw-r--r-- | bin/domain/imag-calendar/src/util.rs | 4 | ||||
-rw-r--r-- | bin/domain/imag-contact/Cargo.toml | 2 | ||||
-rw-r--r-- | bin/domain/imag-contact/src/lib.rs | 2 | ||||
-rw-r--r-- | bin/domain/imag-mail/Cargo.toml | 2 | ||||
-rw-r--r-- | bin/domain/imag-mail/src/util.rs | 2 | ||||
-rw-r--r-- | bin/domain/imag-todo/Cargo.toml | 2 | ||||
-rw-r--r-- | bin/domain/imag-todo/src/util.rs | 2 | ||||
-rw-r--r-- | lib/core/libimagrt/Cargo.toml | 2 | ||||
-rw-r--r-- | lib/core/libimagrt/src/logger.rs | 10 | ||||
-rw-r--r-- | lib/etc/libimaginteraction/Cargo.toml | 2 | ||||
-rw-r--r-- | lib/etc/libimaginteraction/src/format.rs | 32 |
14 files changed, 34 insertions, 34 deletions
diff --git a/bin/core/imag-view/Cargo.toml b/bin/core/imag-view/Cargo.toml index 8eb92907..7015d5f5 100644 --- a/bin/core/imag-view/Cargo.toml +++ b/bin/core/imag-view/Cargo.toml @@ -23,7 +23,7 @@ maintenance = { status = "actively-developed" } log = "0.4.6" toml = "0.5.1" toml-query = "0.10" -handlebars = "2" +handlebars = "3" tempfile = "3.0.9" anyhow = "1" resiter = "0.4.0" diff --git a/bin/domain/imag-bookmark/Cargo.toml b/bin/domain/imag-bookmark/Cargo.toml index f062b16f..f7146822 100644 --- a/bin/domain/imag-bookmark/Cargo.toml +++ b/bin/domain/imag-bookmark/Cargo.toml @@ -26,7 +26,7 @@ toml-query = "0.10" anyhow = "1" resiter = "0.4.0" url = "2" -handlebars = "2" +handlebars = "3" rayon = "1" libimagrt = { version = "0.10.0", path = "../../../lib/core/libimagrt" } diff --git a/bin/domain/imag-calendar/Cargo.toml b/bin/domain/imag-calendar/Cargo.toml index 12146bea..12a5359d 100644 --- a/bin/domain/imag-calendar/Cargo.toml +++ b/bin/domain/imag-calendar/Cargo.toml @@ -26,7 +26,7 @@ anyhow = "1" failure = "0.1" walkdir = "2.2.8" vobject = "0.7" -handlebars = "2" +handlebars = "3" chrono = "0.4" kairos = "0.3" resiter = "0.4.0" diff --git a/bin/domain/imag-calendar/src/util.rs b/bin/domain/imag-calendar/src/util.rs index 1467d310..636e3ec3 100644 --- a/bin/domain/imag-calendar/src/util.rs +++ b/bin/domain/imag-calendar/src/util.rs @@ -71,8 +71,8 @@ impl<'a> ParsedEventFLE<'a> { } } -pub fn get_event_print_format(config_value_path: &'static str, rt: &Runtime, scmd: &ArgMatches) - -> Result<Handlebars> +pub fn get_event_print_format<'rc>(config_value_path: &'static str, rt: &Runtime, scmd: &ArgMatches) + -> Result<Handlebars<'rc>> { scmd.value_of("format") .map(String::from) diff --git a/bin/domain/imag-contact/Cargo.toml b/bin/domain/imag-contact/Cargo.toml index 12f6392e..1bfa66a0 100644 --- a/bin/domain/imag-contact/Cargo.toml +++ b/bin/domain/imag-contact/Cargo.toml @@ -23,7 +23,7 @@ maintenance = { status = "actively-developed" } log = "0.4.6" toml = "0.5.1" vobject = "0.7.0" -handlebars = "2" +handlebars = "3" walkdir = "2.2.8" uuid = { version = "0.7.4", features = ["v4"] } serde_json = "1.0.39" diff --git a/bin/domain/imag-contact/src/lib.rs b/bin/domain/imag-contact/src/lib.rs index 13f17e0f..f7a4af90 100644 --- a/bin/domain/imag-contact/src/lib.rs +++ b/bin/domain/imag-contact/src/lib.rs @@ -380,7 +380,7 @@ fn find(rt: &Runtime) -> Result<()> { } } -fn get_contact_print_format(config_value_path: &'static str, rt: &Runtime, scmd: &ArgMatches) -> Result<Handlebars> { +fn get_contact_print_format<'rc>(config_value_path: &'static str, rt: &Runtime, scmd: &ArgMatches) -> Result<Handlebars<'rc>> { let fmt = match scmd.value_of("format").map(String::from) { Some(s) => Ok(s), None => rt.config() diff --git a/bin/domain/imag-mail/Cargo.toml b/bin/domain/imag-mail/Cargo.toml index a1c0dcab..32cae649 100644 --- a/bin/domain/imag-mail/Cargo.toml +++ b/bin/domain/imag-mail/Cargo.toml @@ -23,7 +23,7 @@ maintenance = { status = "actively-developed" } log = "0.4.6" anyhow = "1" resiter = "0.4" -handlebars = "2" +handlebars = "3" walkdir = "2" rayon = "1" diff --git a/bin/domain/imag-mail/src/util.rs b/bin/domain/imag-mail/src/util.rs index bdd27ba2..151c82fb 100644 --- a/bin/domain/imag-mail/src/util.rs +++ b/bin/domain/imag-mail/src/util.rs @@ -32,7 +32,7 @@ use libimagrt::runtime::Runtime; use libimagstore::store::FileLockEntry; use libimagentryref::reference::Config as RefConfig; -pub fn get_mail_print_format(config_value_path: &'static str, rt: &Runtime, scmd: &ArgMatches) -> Result<Handlebars> { +pub fn get_mail_print_format<'rc>(config_value_path: &'static str, rt: &Runtime, scmd: &ArgMatches) -> Result<Handlebars<'rc>> { let fmt = match scmd.value_of("format").map(String::from) { Some(s) => Ok(s), None => { diff --git a/bin/domain/imag-todo/Cargo.toml b/bin/domain/imag-todo/Cargo.toml index d837b70a..7cd01880 100644 --- a/bin/domain/imag-todo/Cargo.toml +++ b/bin/domain/imag-todo/Cargo.toml @@ -29,7 +29,7 @@ chrono = "0.4" filters = "0.3" kairos = "0.3" resiter = "0.4.0" -handlebars = "2" +handlebars = "3" prettytable-rs = "0.8.0" libimagrt = { version = "0.10.0", path = "../../../lib/core/libimagrt" } diff --git a/bin/domain/imag-todo/src/util.rs b/bin/domain/imag-todo/src/util.rs index 9fce60e6..a22a3ae2 100644 --- a/bin/domain/imag-todo/src/util.rs +++ b/bin/domain/imag-todo/src/util.rs @@ -38,7 +38,7 @@ pub fn get_dt_str(d: Result<Option<NaiveDateTime>>, s: &str) -> Result<String> { .unwrap_or_else(|| s.to_string())) } -pub fn get_todo_print_format(config_value_path: &'static str, rt: &Runtime, scmd: &ArgMatches) -> Result<Handlebars> { +pub fn get_todo_print_format<'rc>(config_value_path: &'static str, rt: &Runtime, scmd: &ArgMatches) -> Result<Handlebars<'rc>> { let fmt = match scmd.value_of("format").map(String::from) { Some(s) => Ok(s), None => { diff --git a/lib/core/libimagrt/Cargo.toml b/lib/core/libimagrt/Cargo.toml index b390496c..c8daf777 100644 --- a/lib/core/libimagrt/Cargo.toml +++ b/lib/core/libimagrt/Cargo.toml @@ -48,7 +48,7 @@ default-features = false features = ["std", "serde"] [dependencies.handlebars] -version = "2" +version = "3" default-features = false features = ["no_logging"] diff --git a/lib/core/libimagrt/src/logger.rs b/lib/core/libimagrt/src/logger.rs index 329f9f09..94d72a16 100644 --- a/lib/core/libimagrt/src/logger.rs +++ b/lib/core/libimagrt/src/logger.rs @@ -48,19 +48,19 @@ impl Default for LogDestination { /// Logger implementation for `log` crate. #[derive(Debug)] -pub struct ImagLogger { +pub struct ImagLogger<'rc> { global_loglevel : Level, #[allow(unused)] global_destinations : Vec<LogDestination>, - handlebars: Handlebars, + handlebars: Handlebars<'rc>, } -impl ImagLogger { +impl<'rc> ImagLogger<'rc> { /// Create a new ImagLogger object with a certain level - pub fn new(matches: &ArgMatches, config: Option<&Value>) -> Result<ImagLogger> { + pub fn new(matches: &ArgMatches, config: Option<&Value>) -> Result<ImagLogger<'rc>> { let mut handlebars = Handlebars::new(); handlebars.register_escape_fn(::handlebars::no_escape); @@ -90,7 +90,7 @@ impl ImagLogger { } -impl Log for ImagLogger { +impl<'rc> Log for ImagLogger<'rc> { fn enabled(&self, metadata: &Metadata) -> bool { metadata.level() <= self.global_loglevel diff --git a/lib/etc/libimaginteraction/Cargo.toml b/lib/etc/libimaginteraction/Cargo.toml index 5309697e..d08ea647 100644 --- a/lib/etc/libimaginteraction/Cargo.toml +++ b/lib/etc/libimaginteraction/Cargo.toml @@ -26,7 +26,7 @@ lazy_static = "1.3.0" log = "0.4.6" regex = "1.1.7" toml = "0.5.1" -handlebars = "2" +handlebars = "3" serde_json = "1.0.39" serde_derive = "1" serde = "1" diff --git a/lib/etc/libimaginteraction/src/format.rs b/lib/etc/libimaginteraction/src/format.rs index 6515df2d..9583237f 100644 --- a/lib/etc/libimaginteraction/src/format.rs +++ b/lib/etc/libimaginteraction/src/format.rs @@ -66,7 +66,7 @@ impl From<String> for HandlebarsData { pub struct ColorizeBlackHelper; impl HelperDef for ColorizeBlackHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { colorize(Colour::Black, h, out) } } @@ -75,7 +75,7 @@ impl HelperDef for ColorizeBlackHelper { pub struct ColorizeBlueHelper; impl HelperDef for ColorizeBlueHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { colorize(Colour::Blue, h, out) } } @@ -84,7 +84,7 @@ impl HelperDef for ColorizeBlueHelper { pub struct ColorizeCyanHelper; impl HelperDef for ColorizeCyanHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { colorize(Colour::Cyan, h, out) } } @@ -93,7 +93,7 @@ impl HelperDef for ColorizeCyanHelper { pub struct ColorizeGreenHelper; impl HelperDef for ColorizeGreenHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { colorize(Colour::Green, h, out) } } @@ -102,7 +102,7 @@ impl HelperDef for ColorizeGreenHelper { pub struct ColorizePurpleHelper; impl HelperDef for ColorizePurpleHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { colorize(Colour::Purple, h, out) } } @@ -111,7 +111,7 @@ impl HelperDef for ColorizePurpleHelper { pub struct ColorizeRedHelper; impl HelperDef for ColorizeRedHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { colorize(Colour::Red, h, out) } } @@ -120,7 +120,7 @@ impl HelperDef for ColorizeRedHelper { pub struct ColorizeWhiteHelper; impl HelperDef for ColorizeWhiteHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { colorize(Colour::White, h, out) } } @@ -129,7 +129,7 @@ impl HelperDef for ColorizeWhiteHelper { pub struct ColorizeYellowHelper; impl HelperDef for ColorizeYellowHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { colorize(Colour::Yellow, h, out) } } @@ -146,7 +146,7 @@ fn colorize(color: Colour, h: &Helper, output: &mut dyn Output) -> Result<(), Re pub struct UnderlineHelper; impl HelperDef for UnderlineHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { let p = h.param(0).ok_or_else(|| RenderError::new("Too few arguments"))?; let s = Style::new().underline(); out.write(&format!("{}", s.paint(p.value().render())))?; @@ -158,7 +158,7 @@ impl HelperDef for UnderlineHelper { pub struct BoldHelper; impl HelperDef for BoldHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { let p = h.param(0).ok_or_else(|| RenderError::new("Too few arguments"))?; let s = Style::new().bold(); out.write(&format!("{}", s.paint(p.value().render())))?; @@ -170,7 +170,7 @@ impl HelperDef for BoldHelper { pub struct BlinkHelper; impl HelperDef for BlinkHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { let p = h.param(0).ok_or_else(|| RenderError::new("Too few arguments"))?; let s = Style::new().blink(); out.write(&format!("{}", s.paint(p.value().render())))?; @@ -182,7 +182,7 @@ impl HelperDef for BlinkHelper { pub struct StrikethroughHelper; impl HelperDef for StrikethroughHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { let p = h.param(0).ok_or_else(|| RenderError::new("Too few arguments"))?; let s = Style::new().strikethrough(); out.write(&format!("{}", s.paint(p.value().render())))?; @@ -215,7 +215,7 @@ fn param_to_number(idx: usize, h: &Helper) -> Result<u64, RenderError> { pub struct LeftPadHelper; impl HelperDef for LeftPadHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { let count = param_to_number(0, h)? as usize; let text = h.param(1).ok_or_else(|| RenderError::new("Too few arguments"))?; let text = format!("{:>width$}", text.value().render(), width = count); @@ -228,7 +228,7 @@ impl HelperDef for LeftPadHelper { pub struct RightPadHelper; impl HelperDef for RightPadHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { let count = param_to_number(0, h)? as usize; let text = h.param(1).ok_or_else(|| RenderError::new("Too few arguments"))?; let text = format!("{:width$}", text.value().render(), width = count); @@ -241,7 +241,7 @@ impl HelperDef for RightPadHelper { pub struct AbbrevHelper; impl HelperDef for AbbrevHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { let count = param_to_number(0, h)? as usize; let text = h.param(1).ok_or_else(|| RenderError::new("Too few arguments"))?.value().render(); out.write(&text.chars().take(count).collect::<String>())?; @@ -254,7 +254,7 @@ impl HelperDef for AbbrevHelper { pub struct IndentionHelper; impl HelperDef for IndentionHelper { - fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg>, out: &mut dyn Output) -> Result<(), RenderError> { + fn call<'reg: 'rc, 'rc>(&self, h: &Helper<'reg, 'rc>, _r: &'reg Registry, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output) -> Result<(), RenderError> { let count = param_to_number(0, h)? as usize; let text = h.param(1).ok_or_else(|| RenderError::new("Too few arguments"))?.value().render(); out.write(&::std::iter::repeat(text).take(count).collect::<String>())?; |