mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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::fmt;
|
||||
use std::cmp;
|
||||
use std::str;
|
||||
use std::u32;
|
||||
|
||||
//////////////////////////////////
|
||||
|
@ -569,6 +570,10 @@ impl nsACString {
|
|||
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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue