Skip to content

Commit

Permalink
Rename DelegateTo to UseDelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
soareschen committed Oct 6, 2024
1 parent c2a3ac0 commit 911e4ba
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/cgp-component/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ pub mod types;

pub use cgp_component_macro::{define_components, delegate_components, derive_component};
pub use traits::{DelegateComponent, HasComponents};
pub use types::{DelegateTo, UseContext, WithContext, WithProvider};
pub use types::{UseContext, UseDelegate, WithContext, WithProvider};
3 changes: 0 additions & 3 deletions crates/cgp-component/src/types/delegate_to.rs

This file was deleted.

4 changes: 2 additions & 2 deletions crates/cgp-component/src/types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod delegate_to;
pub mod use_context;
pub mod use_delegate;
pub mod with_provider;

pub use delegate_to::DelegateTo;
pub use use_context::{UseContext, WithContext};
pub use use_delegate::UseDelegate;
pub use with_provider::WithProvider;
3 changes: 3 additions & 0 deletions crates/cgp-component/src/types/use_delegate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use core::marker::PhantomData;

pub struct UseDelegate<Components>(pub PhantomData<Components>);
4 changes: 2 additions & 2 deletions crates/cgp-error/src/can_raise_error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cgp_component::{derive_component, DelegateComponent, DelegateTo, HasComponents};
use cgp_component::{derive_component, DelegateComponent, HasComponents, UseDelegate};

use crate::has_error_type::HasErrorType;

Expand All @@ -15,7 +15,7 @@ pub trait CanRaiseError<E>: HasErrorType {
fn raise_error(e: E) -> Self::Error;
}

impl<Context, Error, Components, Delegate> ErrorRaiser<Context, Error> for DelegateTo<Components>
impl<Context, Error, Components, Delegate> ErrorRaiser<Context, Error> for UseDelegate<Components>
where
Context: HasErrorType,
Components: DelegateComponent<Error, Delegate = Delegate>,
Expand Down
4 changes: 2 additions & 2 deletions crates/cgp-type/src/traits/has_type.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cgp_component::{derive_component, DelegateComponent, DelegateTo, HasComponents, UseContext};
use cgp_component::{derive_component, DelegateComponent, HasComponents, UseContext, UseDelegate};

#[derive_component(TypeComponent, ProvideType<Context>)]
pub trait HasType<Tag> {
Expand All @@ -12,7 +12,7 @@ where
type Type = Context::Type;
}

impl<Context, Tag, Components, Type> ProvideType<Context, Tag> for DelegateTo<Components>
impl<Context, Tag, Components, Type> ProvideType<Context, Tag> for UseDelegate<Components>
where
Components: DelegateComponent<Tag>,
Components::Delegate: ProvideType<Context, Tag, Type = Type>,
Expand Down

0 comments on commit 911e4ba

Please sign in to comment.