Struct reaper_medium::ReaperString
source · [−]pub struct ReaperString(_);
Expand description
An owned string created by REAPER.
This is is essentially a CString
with UTF-8 guarantee.
Design
This type is used primarily in return positions of reaper-rs functions. It wraps a CString
because REAPER creates C strings. The benefit over just returning CString
is that this type
provides convenience methods for converting to Rust strings directly. Whereas arbitrary
CString
s can have all kinds of encodings, we know that REAPER uses UTF-8, so this type can be
optimistic and converts without returning a Result
.
Implementations
sourceimpl ReaperString
impl ReaperString
sourcepub unsafe fn new_unchecked(inner: CString) -> ReaperString
pub unsafe fn new_unchecked(inner: CString) -> ReaperString
Creates a REAPER string wrapping the given CString
.
Safety
You must ensure that the given CString
is encoded in UTF-8.
sourcepub fn into_inner(self) -> CString
pub fn into_inner(self) -> CString
Consumes this value and spits out the contained C string.
sourcepub fn as_reaper_str(&self) -> &ReaperStr
pub fn as_reaper_str(&self) -> &ReaperStr
Converts to a slice.
sourcepub fn to_str(&self) -> &str
pub fn to_str(&self) -> &str
Converts this value to a Rust string slice.
Panics
This function panics if the string is not properly UTF-8 encoded.
sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes this value and converts it to an owned Rust string.
Panics
This function panics if the string is not properly UTF-8 encoded.
Methods from Deref<Target = ReaperStr>
sourcepub fn to_reaper_string(&self) -> ReaperString
pub fn to_reaper_string(&self) -> ReaperString
Converts a ReaperStr
to an owned ReaperString
.
Trait Implementations
sourceimpl Borrow<ReaperStr> for ReaperString
impl Borrow<ReaperStr> for ReaperString
sourceimpl Clone for ReaperString
impl Clone for ReaperString
sourcefn clone(&self) -> ReaperString
fn clone(&self) -> ReaperString
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for ReaperString
impl Debug for ReaperString
sourceimpl Default for ReaperString
impl Default for ReaperString
sourcefn default() -> ReaperString
fn default() -> ReaperString
sourceimpl Deref for ReaperString
impl Deref for ReaperString
sourceimpl Display for ReaperString
impl Display for ReaperString
sourceimpl<'a> From<ReaperString> for Cow<'a, ReaperStr>
impl<'a> From<ReaperString> for Cow<'a, ReaperStr>
sourcefn from(value: ReaperString) -> Self
fn from(value: ReaperString) -> Self
sourceimpl From<ReaperString> for ReaperStringArg<'static>
impl From<ReaperString> for ReaperStringArg<'static>
sourcefn from(s: ReaperString) -> Self
fn from(s: ReaperString) -> Self
sourceimpl Hash for ReaperString
impl Hash for ReaperString
sourceimpl Ord for ReaperString
impl Ord for ReaperString
sourcefn cmp(&self, other: &ReaperString) -> Ordering
fn cmp(&self, other: &ReaperString) -> Ordering
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialEq<ReaperString> for ReaperString
impl PartialEq<ReaperString> for ReaperString
sourcefn eq(&self, other: &ReaperString) -> bool
fn eq(&self, other: &ReaperString) -> bool
sourceimpl PartialOrd<ReaperString> for ReaperString
impl PartialOrd<ReaperString> for ReaperString
sourcefn partial_cmp(&self, other: &ReaperString) -> Option<Ordering>
fn partial_cmp(&self, other: &ReaperString) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for ReaperString
impl StructuralEq for ReaperString
impl StructuralPartialEq for ReaperString
Auto Trait Implementations
impl RefUnwindSafe for ReaperString
impl Send for ReaperString
impl Sync for ReaperString
impl Unpin for ReaperString
impl UnwindSafe for ReaperString
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read moresourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more