Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/cgp-error/src/traits/can_raise_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::traits::has_error_type::HasErrorType;
provider: ErrorRaiser,
derive_delegate: UseDelegate<SourceError>,
}]
#[use_namespace(@cgp.core.error.ErrorRaiserComponent)]
#[namespace(@cgp.core.error.ErrorRaiserComponent)]
pub trait CanRaiseError<SourceError>: HasErrorType {
fn raise_error(error: SourceError) -> Self::Error;
}
2 changes: 1 addition & 1 deletion crates/cgp-error/src/traits/can_wrap_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::traits::HasErrorType;
provider: ErrorWrapper,
derive_delegate: UseDelegate<Detail>,
}]
#[use_namespace(@cgp.core.error.ErrorWrapperComponent)]
#[namespace(@cgp.core.error.ErrorWrapperComponent)]
pub trait CanWrapError<Detail>: HasErrorType {
fn wrap_error(error: Self::Error, detail: Detail) -> Self::Error;
}
2 changes: 1 addition & 1 deletion crates/cgp-error/src/traits/has_error_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use cgp_type::{TypeProvider, UseType};
<https://patterns.contextgeneric.dev/error-handling.html>
*/
#[cgp_type]
#[use_namespace(@cgp.core.error.ErrorTypeProviderComponent)]
#[namespace(@cgp.core.error.ErrorTypeProviderComponent)]
pub trait HasErrorType {
type Error: Debug;
}
Expand Down
4 changes: 2 additions & 2 deletions crates/cgp-macro-lib/src/attributes/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mod use_namespace;
mod namespace;

pub use use_namespace::*;
pub use namespace::*;
8 changes: 4 additions & 4 deletions crates/cgp-macro-lib/src/derive_component/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ pub fn parse_component_attributes(
}

parsed_attributes.use_type.extend(use_type_specs);
} else if ident == "use_namespace" {
let use_namespace_specs = attribute.parse_args_with(
} else if ident == "namespace" {
let namespace_specs = attribute.parse_args_with(
Punctuated::<UseNamespaceAttribute, Comma>::parse_terminated,
)?;
parsed_attributes.use_namespace.extend(use_namespace_specs);
parsed_attributes.namespace.extend(namespace_specs);
} else {
attributes.push(attribute);
}
Expand All @@ -56,5 +56,5 @@ pub fn parse_component_attributes(
pub struct ComponentAttributes {
pub extend: Vec<TypeParamBound>,
pub use_type: Vec<UseTypeSpec>,
pub use_namespace: Vec<UseNamespaceAttribute>,
pub namespace: Vec<UseNamespaceAttribute>,
}
2 changes: 1 addition & 1 deletion crates/cgp-macro-lib/src/derive_component/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub fn derive_component_with_ast(
}
}

let namespace_impls = derive_namespace_impls(&attributes.use_namespace, component_name)?;
let namespace_impls = derive_namespace_impls(&attributes.namespace, component_name)?;
item_impls.extend(namespace_impls);

let derived = DerivedComponent {
Expand Down
2 changes: 1 addition & 1 deletion crates/cgp-tests/tests/namespace_tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod multi_param;
pub mod namespace;
pub mod namespace_macro;
pub mod open;
pub mod redirect;
pub mod use_namespace;
2 changes: 1 addition & 1 deletion crates/cgp-tests/tests/namespace_tests/multi_param.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cgp::prelude::*;

#[cgp_component(FooProvider)]
#[use_namespace(@app.FooProviderComponent)]
#[namespace(@app.FooProviderComponent)]
pub trait Foo<'a, T, U> {
fn foo(&self, first: &'a T, second: U);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cgp::prelude::*;
pub struct MyComponents;

#[cgp_component(FooProvider)]
#[use_namespace(DefaultNamespace: @app.MyComponents.FooProviderComponent)]
#[namespace(DefaultNamespace: @app.MyComponents.FooProviderComponent)]
pub trait Foo {
fn foo(&self);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cgp_namespace! {
}

#[cgp_component(BarProvider)]
#[use_namespace(MyNamespace: @MyBarComponent)]
#[namespace(MyNamespace: @MyBarComponent)]
pub trait Bar {
fn bar(&self);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ cgp_namespace! {
}

#[cgp_component(BarProvider)]
#[use_namespace(MyNamespace: @MyApp.MyBarComponent)]
#[use_namespace(OtherNamespace: @my_app.MyBarComponent)]
#[namespace(MyNamespace: @MyApp.MyBarComponent)]
#[namespace(OtherNamespace: @my_app.MyBarComponent)]
pub trait Bar {
fn bar(&self);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cgp_namespace! {
}

#[cgp_component(BarProvider)]
#[use_namespace(MyNamespace: @my_app.MyBarComponent)]
#[namespace(MyNamespace: @my_app.MyBarComponent)]
pub trait Bar {
fn bar(&self);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cgp_namespace! {
}

#[cgp_component(BarProvider)]
#[use_namespace(MyNamespace: @MyApp.MyBarComponent)]
#[namespace(MyNamespace: @MyApp.MyBarComponent)]
pub trait Bar {
fn bar(&self);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/cgp-tests/tests/namespace_tests/redirect.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cgp::prelude::*;

#[cgp_component(FooProvider)]
#[use_namespace(@bar.baz.FooProviderComponent)]
#[namespace(@bar.baz.FooProviderComponent)]
pub trait CanDoFoo {
fn foo();
}
Expand Down
Loading