Skip to main content

serde_shape/impls/
jiff02.rs

1// Copyright 2026 FastLabs Developers
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use jiff02::SignedDuration;
16use jiff02::Span;
17use jiff02::Timestamp;
18use jiff02::Zoned;
19use jiff02::civil::Date;
20use jiff02::civil::DateTime;
21use jiff02::civil::ISOWeekDate;
22use jiff02::civil::Time;
23
24use crate::DeserializeShape;
25use crate::DeserializeShapeContext;
26use crate::SerializeShape;
27use crate::SerializeShapeContext;
28use crate::ShapeRef;
29
30macro_rules! string_shape {
31    ($($ty:ty),* $(,)?) => {
32        $(
33            impl SerializeShape for $ty {
34                fn serialize_shape_in(_context: &mut SerializeShapeContext) -> ShapeRef {
35                    ShapeRef::String
36                }
37            }
38
39            impl DeserializeShape for $ty {
40                fn deserialize_shape_in(_context: &mut DeserializeShapeContext) -> ShapeRef {
41                    ShapeRef::String
42                }
43            }
44        )*
45    };
46}
47
48string_shape!(
49    Date,
50    DateTime,
51    ISOWeekDate,
52    SignedDuration,
53    Span,
54    Time,
55    Timestamp,
56    Zoned,
57);