mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Improve jsid_to_str's name and documentation.
This commit is contained in:
parent
821797d6f7
commit
6023560863
2 changed files with 10 additions and 5 deletions
|
@ -115,9 +115,14 @@ impl <T: Reflectable + IDLInterface> FromJSValConvertible for Root<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Convert the given `jsid` to a `DOMString`. Fails if the `jsid` is not a
|
||||
/// string, or if the string does not contain valid UTF-16.
|
||||
pub fn jsid_to_str(cx: *mut JSContext, id: HandleId) -> DOMString {
|
||||
/// Convert `id` to a `DOMString`, assuming it is string-valued.
|
||||
///
|
||||
/// Handling of invalid UTF-16 in strings depends on the relevant option.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `id` is not string-valued.
|
||||
pub fn string_jsid_to_string(cx: *mut JSContext, id: HandleId) -> DOMString {
|
||||
unsafe {
|
||||
assert!(RUST_JSID_IS_STRING(id));
|
||||
jsstring_to_str(cx, RUST_JSID_TO_STRING(id))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue