pub enum DriveScope {
ReadOnly,
Metadata,
}Expand description
The Drive OAuth2 scope granted at login.
Unlike Gmail’s readonly/modify split, Metadata is requested
additively over ReadOnly, never as a replacement: drive.metadata
alone grants no file-content access, so read commands (search, read,
export/download) still need drive.readonly too. The authorization
request for Metadata therefore asks for both scopes together — see
[build_authorization_url].
Variants§
ReadOnly
List/read/export/download files and metadata. Default; never requests any mutation.
Metadata
Everything ReadOnly grants, plus drive.metadata
(files.update on name/parents — rename/move).
Implementations§
Source§impl DriveScope
impl DriveScope
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
Returns the wire scope string Google expects for status-reporting /
storage purposes. For Metadata this is just
SCOPE_METADATA — the additive drive.readonly request shape
lives in [build_authorization_url] alone, since Google’s granted-
scope response and from_granted already
round-trip correctly off the single SCOPE_METADATA token.
Sourcepub fn from_granted(granted: &str) -> Option<Self>
pub fn from_granted(granted: &str) -> Option<Self>
Parses Google’s space-separated granted-scope response, treating the
presence of the metadata scope anywhere in it as
Metadata and the readonly scope (with no
metadata) as ReadOnly.
Returns None when neither Drive scope is present — e.g. the user
left the Drive permission unticked on Google’s consent screen — so
callers can reject the grant instead of silently defaulting to
ReadOnly.
Sourcepub fn allows_write(self) -> bool
pub fn allows_write(self) -> bool
Whether this scope allows mutating calls (files.update on
name/parents — rename/move).
Trait Implementations§
Source§impl Clone for DriveScope
impl Clone for DriveScope
Source§fn clone(&self) -> DriveScope
fn clone(&self) -> DriveScope
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DriveScope
Source§impl Debug for DriveScope
impl Debug for DriveScope
Source§impl Default for DriveScope
impl Default for DriveScope
Source§fn default() -> DriveScope
fn default() -> DriveScope
impl Eq for DriveScope
Source§impl PartialEq for DriveScope
impl PartialEq for DriveScope
impl StructuralPartialEq for DriveScope
Auto Trait Implementations§
impl Freeze for DriveScope
impl RefUnwindSafe for DriveScope
impl Send for DriveScope
impl Sync for DriveScope
impl Unpin for DriveScope
impl UnsafeUnpin for DriveScope
impl UnwindSafe for DriveScope
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.