diff --git a/src/string.rs b/src/string.rs index 811d3432..2a5fee12 100644 --- a/src/string.rs +++ b/src/string.rs @@ -63,7 +63,7 @@ bitflags! { } impl String { - pub fn new_empty<'sc>(scope: &mut impl ToLocal<'sc>) -> Local<'sc, String> { + pub fn empty<'sc>(scope: &mut impl ToLocal<'sc>) -> Local<'sc, String> { let ptr = unsafe { v8__String__Empty(scope.isolate()) }; // FIXME(bnoordhuis) v8__String__Empty() is infallible so there // is no need to box up the result, only to unwrap it again. @@ -76,7 +76,7 @@ impl String { new_type: NewStringType, ) -> Option> { if buffer.is_empty() { - return Some(Self::new_empty(scope)); + return Some(Self::empty(scope)); } let ptr = unsafe { v8__String__NewFromUtf8( diff --git a/tests/test_api.rs b/tests/test_api.rs index c0febe08..1885ec79 100644 --- a/tests/test_api.rs +++ b/tests/test_api.rs @@ -152,7 +152,7 @@ fn test_string() { { let mut hs = v8::HandleScope::new(scope); let scope = hs.enter(); - let local = v8::String::new_empty(scope); + let local = v8::String::empty(scope); assert_eq!(0, local.length()); assert_eq!(0, local.utf8_length(scope)); assert_eq!("", local.to_rust_string_lossy(scope));