Skip to content

Commit

Permalink
refactor: Make delegation::Agent not take &mut self in methods
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus23 committed Mar 20, 2024
1 parent 32164a3 commit 7c50aba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/delegation/agent.rs
Expand Up @@ -29,7 +29,7 @@ pub struct Agent<
pub did: &'a DID,

/// The attached [`deleagtion::Store`][super::store::Store].
pub store: &'a mut S,
pub store: S,

signer: &'a <DID as Did>::Signer,
_marker: PhantomData<(V, Enc)>,
Expand All @@ -47,7 +47,7 @@ where
Payload<DID>: TryFrom<Named<Ipld>>,
Named<Ipld>: From<Payload<DID>>,
{
pub fn new(did: &'a DID, signer: &'a <DID as Did>::Signer, store: &'a mut S) -> Self {
pub fn new(did: &'a DID, signer: &'a <DID as Did>::Signer, store: S) -> Self {
Self {
did,
store,
Expand Down Expand Up @@ -120,7 +120,7 @@ where
}

pub fn receive(
&mut self,
&self,
cid: Cid, // FIXME remove and generate from the capsule header?
delegation: Delegation<DID, V, Enc>,
) -> Result<(), ReceiveError<S::DelegationStoreError, DID>> {
Expand Down
8 changes: 4 additions & 4 deletions src/invocation/agent.rs
Expand Up @@ -86,7 +86,7 @@ where
}

pub fn invoke(
&mut self,
&self,
audience: Option<DID>,
subject: DID,
ability: T,
Expand Down Expand Up @@ -172,7 +172,7 @@ where
// }

pub fn receive(
&mut self,
&self,
invocation: Invocation<T, DID, V, C>,
) -> Result<Recipient<Payload<T, DID>>, ReceiveError<T, DID, D::DelegationStoreError, S, V, C>>
where
Expand All @@ -184,7 +184,7 @@ where
}

pub fn generic_receive(
&mut self,
&self,
invocation: Invocation<T, DID, V, C>,
now: SystemTime,
) -> Result<Recipient<Payload<T, DID>>, ReceiveError<T, DID, D::DelegationStoreError, S, V, C>>
Expand Down Expand Up @@ -233,7 +233,7 @@ where
}

// pub fn revoke(
// &mut self,
// &self,
// subject: DID,
// cause: Option<Cid>,
// cid: Cid,
Expand Down

0 comments on commit 7c50aba

Please sign in to comment.