impl Encoding { /// Constructs an `Encoding` from its string representation. /// Unsafe because the caller must ensure the string is a valid encoding. pubunsafefn from_str(code: &str) -> Encoding {
from_str(code)
}
impl PartialEq for Encoding { fn eq(&self, other: &Encoding) -> bool { // strip qualifiers when comparing let s = self.as_str().trim_left_matches(QUALIFIERS); let o = other.as_str().trim_left_matches(QUALIFIERS);
s == o
}
}
pubunsafefn from_malloc_str(ptr: *mut c_char) -> Encoding { let s = CStr::from_ptr(ptr); let bytes = s.to_bytes_with_nul();
assert!(str::from_utf8(bytes).is_ok()); let buf = MallocBuffer::new(ptr as *mut u8, bytes.len()).unwrap();
Encoding { code: Code::Malloc(buf) }
}
/// Types that have an Objective-C type encoding. /// /// Unsafe because Objective-C will make assumptions about the type (like its /// size and alignment) from its encoding, so the implementer must verify that /// the encoding is accurate. pubunsafetrait Encode { /// Returns the Objective-C type encoding for Self. fn encode() -> Encoding;
}
/// Types that represent a group of arguments, where each has an Objective-C /// type encoding. pubtrait EncodeArguments { /// The type as which the encodings for Self will be returned. type Encs: AsRef<[Encoding]>;
/// Returns the Objective-C type encodings for Self. fn encodings() -> Self::Encs;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.