forked from ucan-wg/rs-ucan
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rounding out types & breaking up modules
- Loading branch information
Showing
19 changed files
with
270 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
use crate::{ | ||
ability::traits::Command, | ||
proof::{checkable::Checkable, parentless::Parentless, same::CheckSame}, | ||
proof::{ | ||
parentless::NoParents, | ||
same::{CheckSame, OptionalFieldErr}, | ||
}, | ||
}; | ||
use serde::{Deserialize, Serialize}; | ||
use url::Url; | ||
|
||
// NOTE no resolved or awaiting variants, because this cannot be executed, and all fields are optional already! | ||
|
||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
#[serde(deny_unknown_fields)] | ||
pub struct AnyBuilder { | ||
pub struct Builder { | ||
#[serde(default, skip_serializing_if = "Option::is_none")] | ||
pub uri: Option<Url>, | ||
} | ||
|
||
impl Command for AnyBuilder { | ||
impl Command for Builder { | ||
const COMMAND: &'static str = "crud/*"; | ||
} | ||
|
||
impl Checkable for AnyBuilder { | ||
type Heirarchy = Parentless<AnyBuilder>; | ||
} | ||
impl NoParents for Builder {} | ||
|
||
impl CheckSame for AnyBuilder { | ||
type Error = (); | ||
fn check_same(&self, _proof: &Self) -> Result<(), Self::Error> { | ||
Ok(()) | ||
impl CheckSame for Builder { | ||
type Error = OptionalFieldErr; | ||
fn check_same(&self, proof: &Self) -> Result<(), Self::Error> { | ||
self.uri.check_same(&proof.uri) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.