File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,7 @@ pub enum Sign {
20
20
/// Various ways to describe a time format.
21
21
#[ derive( Debug , Clone , Copy ) ]
22
22
pub enum Format {
23
- /// A custom format limited to what's in the
24
- /// [`format`](mod@crate::time::format) submodule.
23
+ /// A custom format limited to what's in the [`format`](mod@format) submodule.
25
24
Custom ( CustomFormat ) ,
26
25
/// The seconds since 1970, also known as unix epoch, like `1660874655`.
27
26
Unix ,
@@ -33,6 +32,13 @@ pub enum Format {
33
32
#[ derive( Clone , Copy , Debug ) ]
34
33
pub struct CustomFormat ( pub ( crate ) & ' static str ) ;
35
34
35
+ impl CustomFormat {
36
+ /// Create a new custom `format` suitable for use with the [`jiff`] crate.
37
+ pub const fn new ( format : & ' static str ) -> Self {
38
+ Self ( format)
39
+ }
40
+ }
41
+
36
42
impl From < CustomFormat > for Format {
37
43
fn from ( custom_format : CustomFormat ) -> Format {
38
44
Format :: Custom ( custom_format)
You can’t perform that action at this time.
0 commit comments