#[non_exhaustive]pub struct ReadWritePermissions {
pub read: bool,
pub write: bool,
}Expand description
Permissions indicating allowed operations.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.read: boolRead permission.
Defaults to false.
write: boolWrite permission.
Defaults to false.
Implementations§
Source§impl ReadWritePermissions
impl ReadWritePermissions
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new ReadWritePermissions with default values.
Sourcepub fn read_only() -> Self
pub fn read_only() -> Self
Create read-only permissions.
Examples found in repository?
examples/issue_access_token.rs (line 23)
10async fn main() -> Result<(), Box<dyn std::error::Error>> {
11 let access_token =
12 std::env::var("S2_ACCESS_TOKEN").map_err(|_| "S2_ACCESS_TOKEN env var not set")?;
13 let basin_name: BasinName = std::env::var("S2_BASIN")
14 .map_err(|_| "S2_BASIN env var not set")?
15 .parse()?;
16
17 let config = S2Config::new(access_token);
18 let s2 = S2::new(config)?;
19
20 let input = IssueAccessTokenInput::new(
21 "ro-token".parse()?,
22 AccessTokenScopeInput::from_op_group_perms(
23 OperationGroupPermissions::new().with_account(ReadWritePermissions::read_only()),
24 )
25 .with_ops([Operation::CreateStream])
26 .with_streams(StreamMatcher::Prefix("audit".parse()?))
27 .with_basins(BasinMatcher::Exact(basin_name)),
28 );
29 let issued_token = s2.issue_access_token(input).await?;
30 println!("Issued access token: {issued_token}");
31
32 Ok(())
33}Sourcepub fn write_only() -> Self
pub fn write_only() -> Self
Create write-only permissions.
Sourcepub fn read_write() -> Self
pub fn read_write() -> Self
Create read-write permissions.
Trait Implementations§
Source§impl Clone for ReadWritePermissions
impl Clone for ReadWritePermissions
Source§fn clone(&self) -> ReadWritePermissions
fn clone(&self) -> ReadWritePermissions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReadWritePermissions
impl Debug for ReadWritePermissions
Source§impl Default for ReadWritePermissions
impl Default for ReadWritePermissions
Source§fn default() -> ReadWritePermissions
fn default() -> ReadWritePermissions
Returns the “default value” for a type. Read more
Source§impl From<ReadWritePermissions> for ReadWritePermissions
impl From<ReadWritePermissions> for ReadWritePermissions
Source§fn from(value: ReadWritePermissions) -> Self
fn from(value: ReadWritePermissions) -> Self
Converts to this type from the input type.
Source§impl From<ReadWritePermissions> for ReadWritePermissions
impl From<ReadWritePermissions> for ReadWritePermissions
Source§fn from(value: ReadWritePermissions) -> Self
fn from(value: ReadWritePermissions) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ReadWritePermissions
impl RefUnwindSafe for ReadWritePermissions
impl Send for ReadWritePermissions
impl Sync for ReadWritePermissions
impl Unpin for ReadWritePermissions
impl UnwindSafe for ReadWritePermissions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more