MCPcopy Create free account
hub / github.com/SSheldon/rust-objc / as_str

Method as_str

src/encode.rs:48–59  ·  view source on GitHub ↗

Returns self as a `str`.

(&self)

Source from the content-addressed store, hash-verified

46
47 /// Returns self as a `str`.
48 pub fn as_str(&self) -> &str {
49 match self.code {
50 Code::Slice(code) => code,
51 Code::Owned(ref code) => code,
52 Code::Inline(len, ref bytes) => unsafe {
53 str::from_utf8_unchecked(&bytes[..len as usize])
54 },
55 Code::Malloc(ref buf) => unsafe {
56 str::from_utf8_unchecked(&buf[..buf.len() - 1])
57 },
58 }
59 }
60}
61
62impl Clone for Encoding {

Callers 5

cloneMethod · 0.80
eqMethod · 0.80
encodeMethod · 0.80
method_type_encodingFunction · 0.80
add_ivarMethod · 0.80

Calls

no outgoing calls

Tested by 1

encodeMethod · 0.64