From aadc8df8c704df12938604370cb73cf8ee16e0f6 Mon Sep 17 00:00:00 2001 From: Zoey Llewellyn Hewll Date: Thu, 16 Nov 2023 15:56:04 +0800 Subject: [PATCH] implement AsRef for ArrayString --- src/array_string.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/array_string.rs b/src/array_string.rs index 1144360..8ddc1a2 100644 --- a/src/array_string.rs +++ b/src/array_string.rs @@ -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; @@ -501,6 +502,12 @@ impl fmt::Debug for ArrayString fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) } } +impl AsRef for ArrayString { + fn as_ref(&self) -> &Path { + self.as_str().as_ref() + } +} + impl fmt::Display for ArrayString { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) }