File tree Expand file tree Collapse file tree 4 files changed +4
-33
lines changed Expand file tree Collapse file tree 4 files changed +4
-33
lines changed Original file line number Diff line number Diff line change @@ -54,32 +54,6 @@ impl PartialDate {
54
54
* self == Self :: default ( )
55
55
}
56
56
57
- pub ( crate ) fn try_from_year_month ( year_month : & PlainYearMonth ) -> TemporalResult < Self > {
58
- let ( year, era, era_year) = if year_month. era ( ) . is_some ( ) {
59
- (
60
- None ,
61
- year_month
62
- . era ( )
63
- . map ( |t| TinyAsciiStr :: < 19 > :: try_from_utf8 ( t. as_bytes ( ) ) )
64
- . transpose ( )
65
- . map_err ( |e| TemporalError :: general ( format ! ( "{e}" ) ) ) ?,
66
- year_month. era_year ( ) ,
67
- )
68
- } else {
69
- ( Some ( year_month. year ( ) ) , None , None )
70
- } ;
71
- Ok ( Self {
72
- year,
73
- month : Some ( year_month. month ( ) ) ,
74
- month_code : Some ( year_month. month_code ( ) ) ,
75
- day : Some ( 1 ) ,
76
- era,
77
- era_year,
78
- calendar : year_month. calendar ( ) . clone ( ) ,
79
- } )
80
- }
81
-
82
- crate :: impl_with_fallback_method!( with_fallback_year_month, ( ) PlainYearMonth ) ; // excludes day
83
57
crate :: impl_with_fallback_method!( with_fallback_date, ( with_day: day) PlainDate ) ;
84
58
crate :: impl_with_fallback_method!( with_fallback_datetime, ( with_day: day) PlainDateTime ) ;
85
59
}
Original file line number Diff line number Diff line change @@ -42,11 +42,6 @@ pub struct PartialYearMonth {
42
42
}
43
43
44
44
impl PartialYearMonth {
45
- /// Returns a boolean for if the current `PartialYearMonth` is empty.
46
- pub ( crate ) fn is_empty ( & self ) -> bool {
47
- * self == Self :: default ( )
48
- }
49
-
50
45
pub ( crate ) fn try_from_year_month ( year_month : & PlainYearMonth ) -> TemporalResult < Self > {
51
46
let ( year, era, era_year) = if year_month. era ( ) . is_some ( ) {
52
47
(
Original file line number Diff line number Diff line change @@ -99,8 +99,9 @@ pub mod ffi {
99
99
partial : PartialDate ,
100
100
overflow : ArithmeticOverflow ,
101
101
) -> Result < Box < PlainYearMonth > , TemporalError > {
102
+ let partial: temporal_rs:: partial:: PartialDate = partial. try_into ( ) ?;
102
103
self . 0
103
- . year_month_from_partial ( & partial. try_into ( ) ? , overflow. into ( ) )
104
+ . year_month_from_partial ( & temporal_rs :: partial:: PartialYearMonth :: from ( & partial ) , overflow. into ( ) )
104
105
. map ( |c| Box :: new ( PlainYearMonth ( c) ) )
105
106
. map_err ( Into :: into)
106
107
}
Original file line number Diff line number Diff line change @@ -44,8 +44,9 @@ pub mod ffi {
44
44
partial : PartialDate ,
45
45
overflow : Option < ArithmeticOverflow > ,
46
46
) -> Result < Box < Self > , TemporalError > {
47
+ let partial: temporal_rs:: partial:: PartialDate = partial. try_into ( ) ?;
47
48
self . 0
48
- . with ( partial. try_into ( ) ? , overflow. map ( Into :: into) )
49
+ . with ( temporal_rs :: partial:: PartialYearMonth :: from ( & partial ) , overflow. map ( Into :: into) )
49
50
. map ( |x| Box :: new ( Self ( x) ) )
50
51
. map_err ( Into :: into)
51
52
}
You can’t perform that action at this time.
0 commit comments