pub struct PvString(/* private fields */);Expand description
A wire string: a sequence of bytes that is not guaranteed to be valid
UTF-8. Backs EpicsValue::String/StringArray and (in epics-pva-rs)
ScalarValue::String/TypedScalarArray::String. See the module docs for
why this is a byte newtype rather than String.
Implementations§
Source§impl PvString
impl PvString
Sourcepub fn from_bytes(bytes: impl Into<Vec<u8>>) -> PvString
pub fn from_bytes(bytes: impl Into<Vec<u8>>) -> PvString
Wrap raw bytes verbatim (the decode path: bytes straight off the wire).
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
The logical bytes, layout-agnostic (an encoder applies CA’s 40-byte NUL padding or PVA’s size prefix; this is the unframed content).
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Consume into the owned byte buffer.
Sourcepub fn as_str_lossy(&self) -> Cow<'_, str>
pub fn as_str_lossy(&self) -> Cow<'_, str>
Lossy UTF-8 view for diagnostics / JSON / text comparisons where a
faithful byte rendering is not required. Non-UTF-8 bytes become
U+FFFD. For pvxs-faithful CLI output, escape Self::as_bytes
byte-wise instead.
Trait Implementations§
impl Eq for PvString
Source§impl Ord for PvString
impl Ord for PvString
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for PvString
impl PartialOrd for PvString
impl StructuralPartialEq for PvString
Auto Trait Implementations§
impl Freeze for PvString
impl RefUnwindSafe for PvString
impl Send for PvString
impl Sync for PvString
impl Unpin for PvString
impl UnsafeUnpin for PvString
impl UnwindSafe for PvString
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
Compare self to
key and return true if they are equal.