S3Path

Struct S3Path 

Source
pub struct S3Path<'i>(/* private fields */);
Expand description

A borrowed, unsized S3 storage path.

Implementations§

Source§

impl<'i> S3Path<'i>

Source

pub fn new( components: &'i [Cow<'i, str>], ) -> Result<&'i S3Path<'i>, InvalidS3PathComponent>

Create a new S3Path from a slice of static components.

§Errors

Returns Err when any given component

  • is empty
  • contains characters other than: ascii alphanumeric characters, ‘-’, ‘_’ and ‘.’
  • is equal to . or ..
Source

pub fn to_owned(&'i self) -> S3PathBuf

Converts to an owned S3PathBuf.

Source

pub fn join<C: Into<Cow<'static, str>>>( &self, component: C, ) -> Result<S3PathBuf, InvalidS3PathComponent>

Converts to an owned S3PathBuf and appends component to it after validating it.

§Errors

Returns Err when the given component

  • is empty
  • contains characters other than: ascii alphanumeric characters, ‘-’, ‘_’ and ‘.’
  • is equal to . or ..
Source

pub fn is_empty(&'i self) -> bool

Returns true if this path has no components.

Source

pub fn len(&'i self) -> usize

Returns the number of components in this path.

Source

pub fn components(&'i self) -> impl Iterator<Item = &'i str>

Returns an iterator over the components of this path.

Source

pub fn get(&'i self, index: usize) -> Option<&'i str>

Returns the component at the given index, or None if the index is out of bounds.

Source

pub fn last(&'i self) -> Option<&'i str>

Returns the last component of this path, or None if the path is empty.

Source

pub fn parent(&'i self) -> Option<&'i S3Path<'i>>

Returns all but the last component of this path, or None if the path is empty.

Source

pub fn to_std_path_buf(&self) -> PathBuf

Convert this S3 path to a std::path::PathBuf, allowing you to use this S3 path as a system file path.

Our strong guarantee that path components only consist of ascii alphanumeric characters, ‘-’, ‘_’ and ‘.’ and that no path traversal components (‘.’ and ‘..’) are allowed, makes this a safe operation.

Trait Implementations§

Source§

impl<'i> AsRef<S3Path<'i>> for S3Path<'i>

Source§

fn as_ref(&self) -> &S3Path<'i>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'i> AsRef<S3Path<'i>> for S3PathBuf

Source§

fn as_ref(&self) -> &S3Path<'i>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for S3Path<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for S3Path<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'i> PartialEq<&&S3Path<'i>> for S3PathBuf

Allow comparisons between S3Path and S3PathBuf.

Source§

fn eq(&self, other: &&&S3Path<'i>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'i> PartialEq<&S3Path<'i>> for S3PathBuf

Allow comparisons between S3Path and S3PathBuf.

Source§

fn eq(&self, other: &&S3Path<'i>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<S3Path<'_>> for S3PathBuf

Allow comparisons between S3Path and S3PathBuf.

Source§

fn eq(&self, other: &S3Path<'_>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<S3PathBuf> for &S3Path<'_>

Allow comparisons between S3Path and S3PathBuf.

Source§

fn eq(&self, other: &S3PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<S3PathBuf> for S3Path<'_>

Allow comparisons between S3Path and S3PathBuf.

Source§

fn eq(&self, other: &S3PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'i> PartialEq for S3Path<'i>

Source§

fn eq(&self, other: &S3Path<'i>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'i> Eq for S3Path<'i>

Source§

impl<'i> StructuralPartialEq for S3Path<'i>

Auto Trait Implementations§

§

impl<'i> Freeze for S3Path<'i>

§

impl<'i> RefUnwindSafe for S3Path<'i>

§

impl<'i> Send for S3Path<'i>

§

impl<'i> !Sized for S3Path<'i>

§

impl<'i> Sync for S3Path<'i>

§

impl<'i> Unpin for S3Path<'i>

§

impl<'i> UnwindSafe for S3Path<'i>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more