1//! Generic constructors for newtypes
2
3#![allow(non_snake_case)]
4
5use crate::{Font as FontType, Label as LabelType, Output as OutputType, Title as TitleType};
6use std::borrow::Cow;
7use std::path::Path;
8
9/// Generic constructor for `Font`
10#[cfg_attr(feature = "cargo-clippy", allow(clippy::inline_always))]
11#[inline(always)]
12pub fn Font<S>(string: S) -> FontType
13where
14 S: Into<Cow<'static, str>>,
15{
16 FontType(string.into())
17}
18
19/// Generic constructor for `Label`
20#[cfg_attr(feature = "cargo-clippy", allow(clippy::inline_always))]
21#[inline(always)]
22pub fn Label<S>(string: S) -> LabelType
23where
24 S: Into<Cow<'static, str>>,
25{
26 LabelType(string.into())
27}
28
29/// Generic constructor for `Title`
30#[cfg_attr(feature = "cargo-clippy", allow(clippy::inline_always))]
31#[inline(always)]
32pub fn Title<S>(string: S) -> TitleType
33where
34 S: Into<Cow<'static, str>>,
35{
36 TitleType(string.into())
37}
38
39/// Generic constructor for `Output`
40#[cfg_attr(feature = "cargo-clippy", allow(clippy::inline_always))]
41#[inline(always)]
42pub fn Output<P>(path: P) -> OutputType
43where
44 P: Into<Cow<'static, Path>>,
45{
46 OutputType(path.into())
47}
48