Skip to content

Commit

Permalink
implement AsRef<Path> for ArrayString
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoybean committed Nov 16, 2023
1 parent 2c92a59 commit 68351ee
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/array_string.rs
Expand Up @@ -5,6 +5,7 @@ use std::fmt;
use std::hash::{Hash, Hasher};
use std::mem::MaybeUninit;
use std::ops::{Deref, DerefMut};
use std::path::Path;
use std::ptr;
use std::slice;
use std::str;
Expand Down Expand Up @@ -498,6 +499,12 @@ impl<const CAP: usize> fmt::Debug for ArrayString<CAP>
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) }
}

impl<const CAP: usize> AsRef<Path> for ArrayString<CAP> {
fn as_ref(&self) -> &Path {
self.as_str().as_ref()
}
}

impl<const CAP: usize> fmt::Display for ArrayString<CAP>
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) }
Expand Down

0 comments on commit 68351ee

Please sign in to comment.