Skip to content

Commit f757331

Browse files
authored
Merge pull request #11 from contextgeneric/v0.6.0-release
Publish v0.6.0 release post
2 parents c82d383 + cf19728 commit f757331

File tree

9 files changed

+411
-125
lines changed

9 files changed

+411
-125
lines changed

code/Cargo.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ path = "bin/abstract_name.rs"
1515
cgp = { version = "0.5.0" }
1616

1717
[patch.crates-io]
18-
cgp = { git = "https://github.com/contextgeneric/cgp.git", branch = "v0.5.0-release" }
18+
cgp = { git = "https://github.com/contextgeneric/cgp.git" }

code/bin/hello.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,25 @@ pub trait HasName {
1414
}
1515

1616
// Implement `Greeter` that is generic over `Context`
17-
#[cgp_new_provider]
18-
impl<Context> Greeter<Context> for GreetHello
17+
#[cgp_impl(new GreetHello)]
18+
impl<Context> Greeter for Context
1919
where
2020
Context: HasName, // Inject the `name` dependency from `Context`
2121
{
22-
fn greet(context: &Context) {
23-
// `self` is replaced by `context` inside providers
24-
println!("Hello, {}!", context.name());
22+
fn greet(&self) {
23+
println!("Hello, {}!", self.name());
2524
}
2625
}
2726

2827
// A concrete context that uses CGP components
29-
#[cgp_context]
3028
#[derive(HasField)] // Deriving `HasField` automatically implements `HasName`
3129
pub struct Person {
3230
pub name: String,
3331
}
3432

35-
// Compile-time wiring and checking of CGP components
36-
delegate_and_check_components! {
37-
CanUsePerson for Person;
38-
PersonComponents {
33+
// Compile-time wiring of CGP components
34+
delegate_components! {
35+
Person {
3936
GreeterComponent: GreetHello, // Use `GreetHello` to provide `Greeter`
4037
}
4138
}

content/_index.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ sort_by = "weight"
1010

1111
# Announcement
1212

13-
I am thrilled to announce the release of [**CGP v0.5.0**](/blog/v0-5-0-release/)! This new release includes many exciting features and improvements, including auto dispatchers with `#[cgp_auto_dispatch]`, extensible datatype improvements, monadic computation, emulation of return type notation (RTN), sneak preview of `cgp-serde`, and more.
13+
I’m excited to announce the release of [**CGP v0.6.0**](/blog/v0-6-0-release/)!
14+
This version introduces major ergonomic improvements that make provider and context implementations simpler and more intuitive to write.
1415

15-
[Read the announcement blog post](/blog/v0-5-0-release/) to find out more.
16+
The new `#[cgp_impl]` and `#[cgp_inherit]` macros replace `#[cgp_provider]` and `#[cgp_context]`, offering cleaner syntax and greatly improving the readability of CGP code.
17+
18+
[Read the announcement blog post](/blog/v0-6-0-release/) to find out more.
1619

1720
# Overview
1821

0 commit comments

Comments
 (0)