mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Add as_str_unchecked() to nsACString
This commit is contained in:
parent
8bd7978980
commit
eeada5ac51
1 changed files with 5 additions and 0 deletions
|
@ -144,6 +144,7 @@ use std::ptr;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
use std::str;
|
||||||
use std::u32;
|
use std::u32;
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
|
@ -569,6 +570,10 @@ impl nsACString {
|
||||||
Gecko_AppendUTF16toCString(self as *mut _, other as *const _);
|
Gecko_AppendUTF16toCString(self as *mut _, other as *const _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub unsafe fn as_str_unchecked(&self) -> &str {
|
||||||
|
str::from_utf8_unchecked(self)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a str> for nsCString<'a> {
|
impl<'a> From<&'a str> for nsCString<'a> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue