Skip to content

Commit 9b8284d

Browse files
committed
Replace all use of #[cgp_provider] with #[cgp_impl]
1 parent 953e2ed commit 9b8284d

File tree

16 files changed

+54
-56
lines changed

16 files changed

+54
-56
lines changed

crates/cgp-serde-alloc/src/providers/alloc_deserialize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use cgp_serde::components::{CanDeserializeValue, ValueDeserializer, ValueDeseria
33

44
use crate::traits::CanAlloc;
55

6-
#[cgp_new_provider]
7-
impl<'de, 'a, Context, Value> ValueDeserializer<'de, Context, &'a Value> for DeserializeAndAllocate
6+
#[cgp_impl(new DeserializeAndAllocate)]
7+
impl<'de, 'a, Context, Value> ValueDeserializer<'de, &'a Value> for Context
88
where
99
Context: CanAlloc<'a, Value> + CanDeserializeValue<'de, Value>,
1010
{

crates/cgp-serde-extra/src/providers/base64.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use serde::de::Error;
1111

1212
pub struct SerializeBase64;
1313

14-
#[cgp_provider]
15-
impl<Context, Value> ValueSerializer<Context, Value> for SerializeBase64
14+
#[cgp_impl(SerializeBase64)]
15+
impl<Context, Value> ValueSerializer<Value> for Context
1616
where
1717
Value: AsRef<[u8]>,
1818
Context: CanSerializeValue<String>,
@@ -26,8 +26,8 @@ where
2626
}
2727
}
2828

29-
#[cgp_provider]
30-
impl<'de, Context> ValueDeserializer<'de, Context, Vec<u8>> for SerializeBase64
29+
#[cgp_impl(SerializeBase64)]
30+
impl<'de, Context> ValueDeserializer<'de, Vec<u8>> for Context
3131
where
3232
Context: CanDeserializeValue<'de, String>,
3333
{

crates/cgp-serde-extra/src/providers/date.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use serde::de::Error;
1010

1111
pub struct SerializeRfc3339Date;
1212

13-
#[cgp_provider]
14-
impl<Context> ValueSerializer<Context, DateTime<Utc>> for SerializeRfc3339Date
13+
#[cgp_impl(SerializeRfc3339Date)]
14+
impl<Context> ValueSerializer<DateTime<Utc>> for Context
1515
where
1616
Context: CanSerializeValue<String>,
1717
{
@@ -27,8 +27,8 @@ where
2727
}
2828
}
2929

30-
#[cgp_provider]
31-
impl<'de, Context> ValueDeserializer<'de, Context, DateTime<Utc>> for SerializeRfc3339Date
30+
#[cgp_impl(SerializeRfc3339Date)]
31+
impl<'de, Context> ValueDeserializer<'de, DateTime<Utc>> for Context
3232
where
3333
Context: CanDeserializeValue<'de, String>,
3434
{

crates/cgp-serde-extra/src/providers/hex.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use serde::de::Error;
1111

1212
pub struct SerializeHex;
1313

14-
#[cgp_provider]
15-
impl<Context, Value> ValueSerializer<Context, Value> for SerializeHex
14+
#[cgp_impl(SerializeHex)]
15+
impl<Context, Value> ValueSerializer<Value> for Context
1616
where
1717
Value: ToHex,
1818
Context: CanSerializeValue<String>,
@@ -26,8 +26,8 @@ where
2626
}
2727
}
2828

29-
#[cgp_provider]
30-
impl<'de, Context, Value> ValueDeserializer<'de, Context, Value> for SerializeHex
29+
#[cgp_impl(SerializeHex)]
30+
impl<'de, Context, Value> ValueDeserializer<'de, Value> for Context
3131
where
3232
Context: CanDeserializeValue<'de, String>,
3333
Value: FromHex<Error: Display>,

crates/cgp-serde-extra/src/providers/timestamp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use serde::de::Error;
88

99
pub struct SerializeTimestamp;
1010

11-
#[cgp_provider]
12-
impl<Context> ValueSerializer<Context, DateTime<Utc>> for SerializeTimestamp
11+
#[cgp_impl(SerializeTimestamp)]
12+
impl<Context> ValueSerializer<DateTime<Utc>> for Context
1313
where
1414
Context: CanSerializeValue<i64>,
1515
{
@@ -25,8 +25,8 @@ where
2525
}
2626
}
2727

28-
#[cgp_provider]
29-
impl<'de, Context> ValueDeserializer<'de, Context, DateTime<Utc>> for SerializeTimestamp
28+
#[cgp_impl(SerializeTimestamp)]
29+
impl<'de, Context> ValueDeserializer<'de, DateTime<Utc>> for Context
3030
where
3131
Context: CanDeserializeValue<'de, i64>,
3232
{

crates/cgp-serde-json/src/impls/from_str.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ pub struct DeserializeFromJsonString<InDeserializer = DeserializeFromJsonReader>
77
pub PhantomData<InDeserializer>,
88
);
99

10-
#[cgp_provider]
11-
impl<'a, Context, Code, Value, S, InDeserializer> TryComputer<Context, Code, &'a S>
12-
for DeserializeFromJsonString<InDeserializer>
10+
#[cgp_impl(DeserializeFromJsonString<InDeserializer>)]
11+
impl<'a, Context, Code, Value, S, InDeserializer> TryComputer<Code, &'a S> for Context
1312
where
1413
Context: HasErrorType,
1514
InDeserializer: TryComputer<Context, Code, StrRead<'a>, Output = Value>,

crates/cgp-serde-typed-arena/src/providers/alloc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use cgp_serde_alloc::traits::{Allocator, AllocatorComponent};
33

44
use crate::traits::HasArena;
55

6-
#[cgp_new_provider]
7-
impl<'a, Context, Value: 'a> Allocator<'a, Context, Value> for AllocateWithArena
6+
#[cgp_impl(new AllocateWithArena)]
7+
impl<'a, Context, Value: 'a> Allocator<'a, Value> for Context
88
where
99
Context: HasArena<'a, Value>,
1010
{

crates/cgp-serde/src/providers/bytes.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use crate::components::{
99

1010
pub struct SerializeBytes;
1111

12-
#[cgp_provider]
13-
impl<Context, Value> ValueSerializer<Context, Value> for SerializeBytes
12+
#[cgp_impl(SerializeBytes)]
13+
impl<Context, Value> ValueSerializer<Value> for Context
1414
where
1515
Value: AsRef<[u8]>,
1616
{
@@ -22,22 +22,22 @@ where
2222
}
2323
}
2424

25-
#[cgp_provider]
26-
impl<'a, Context, Value> ValueDeserializer<'a, Context, Value> for SerializeBytes
25+
#[cgp_impl(SerializeBytes)]
26+
impl<'a, Context, Value> ValueDeserializer<'a, Value> for Context
2727
where
2828
Value: From<&'a [u8]>,
2929
{
3030
fn deserialize<D>(_context: &Context, deserializer: D) -> Result<Value, D::Error>
3131
where
3232
D: serde::Deserializer<'a>,
3333
{
34-
let bytes = deserializer.deserialize_bytes(Self)?;
34+
let bytes = deserializer.deserialize_bytes(SerializeBytes)?;
3535
Ok(bytes.into())
3636
}
3737
}
3838

39-
#[cgp_new_provider]
40-
impl<'a, Context, Value> ValueDeserializer<'a, Context, Value> for TryDeserializeBytes
39+
#[cgp_impl(new TryDeserializeBytes)]
40+
impl<'a, Context, Value> ValueDeserializer<'a, Value> for Context
4141
where
4242
Value: TryFrom<&'a [u8], Error: Display>,
4343
{

crates/cgp-serde/src/providers/display.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ where
2525
}
2626
}
2727

28-
#[cgp_new_provider]
29-
impl<'a, Context, Value> ValueDeserializer<'a, Context, Value> for DeserializeWithFromStr
28+
#[cgp_impl(new DeserializeWithFromStr)]
29+
impl<'a, Context, Value> ValueDeserializer<'a, Value> for Context
3030
where
3131
Context: CanDeserializeValue<'a, &'a str>,
3232
Value: FromStr<Err: Display>,

crates/cgp-serde/src/providers/extend.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use crate::components::{CanDeserializeValue, ValueDeserializer, ValueDeserialize
55

66
pub struct DeserializeExtend;
77

8-
#[cgp_provider]
9-
impl<'de, Context, Value, Item> ValueDeserializer<'de, Context, Value> for DeserializeExtend
8+
#[cgp_impl(DeserializeExtend)]
9+
impl<'de, Context, Value, Item> ValueDeserializer<'de, Value> for Context
1010
where
1111
Value: Default + IntoIterator<Item = Item> + Extend<Item>,
1212
Context: CanDeserializeValue<'de, Item>,

0 commit comments

Comments
 (0)