提交 ce11f196 编写于 作者: P Patrick Walton

librustuv: Remove all uses of `~str` from `librustuv`

上级 78bc758c
...@@ -353,21 +353,21 @@ fn get_blockers(&self) -> uint { ...@@ -353,21 +353,21 @@ fn get_blockers(&self) -> uint {
pub struct UvError(c_int); pub struct UvError(c_int);
impl UvError { impl UvError {
pub fn name(&self) -> ~str { pub fn name(&self) -> StrBuf {
unsafe { unsafe {
let inner = match self { &UvError(a) => a }; let inner = match self { &UvError(a) => a };
let name_str = uvll::uv_err_name(inner); let name_str = uvll::uv_err_name(inner);
assert!(name_str.is_not_null()); assert!(name_str.is_not_null());
from_c_str(name_str) from_c_str(name_str).to_strbuf()
} }
} }
pub fn desc(&self) -> ~str { pub fn desc(&self) -> StrBuf {
unsafe { unsafe {
let inner = match self { &UvError(a) => a }; let inner = match self { &UvError(a) => a };
let desc_str = uvll::uv_strerror(inner); let desc_str = uvll::uv_strerror(inner);
assert!(desc_str.is_not_null()); assert!(desc_str.is_not_null());
from_c_str(desc_str) from_c_str(desc_str).to_strbuf()
} }
} }
......
...@@ -851,7 +851,7 @@ mod test { ...@@ -851,7 +851,7 @@ mod test {
fn connect_close_ip4() { fn connect_close_ip4() {
match TcpWatcher::connect(local_loop(), next_test_ip4(), None) { match TcpWatcher::connect(local_loop(), next_test_ip4(), None) {
Ok(..) => fail!(), Ok(..) => fail!(),
Err(e) => assert_eq!(e.name(), "ECONNREFUSED".to_owned()), Err(e) => assert_eq!(e.name(), "ECONNREFUSED".to_strbuf()),
} }
} }
...@@ -859,7 +859,7 @@ fn connect_close_ip4() { ...@@ -859,7 +859,7 @@ fn connect_close_ip4() {
fn connect_close_ip6() { fn connect_close_ip6() {
match TcpWatcher::connect(local_loop(), next_test_ip6(), None) { match TcpWatcher::connect(local_loop(), next_test_ip6(), None) {
Ok(..) => fail!(), Ok(..) => fail!(),
Err(e) => assert_eq!(e.name(), "ECONNREFUSED".to_owned()), Err(e) => assert_eq!(e.name(), "ECONNREFUSED".to_strbuf()),
} }
} }
......
...@@ -338,7 +338,7 @@ fn connect_err() { ...@@ -338,7 +338,7 @@ fn connect_err() {
fn bind_err() { fn bind_err() {
match PipeListener::bind(local_loop(), &"path/to/nowhere".to_c_str()) { match PipeListener::bind(local_loop(), &"path/to/nowhere".to_c_str()) {
Ok(..) => fail!(), Ok(..) => fail!(),
Err(e) => assert_eq!(e.name(), "EACCES".to_owned()), Err(e) => assert_eq!(e.name(), "EACCES".to_strbuf()),
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册