added catch attribute to the Generator methods, consistent rust keyword name

This commit is contained in:
Alexander Kryvomaz
2018-07-04 01:22:56 +03:00
parent b797bbc39c
commit eac2b05b1b
2 changed files with 29 additions and 20 deletions

View File

@ -374,25 +374,25 @@ extern "C" {
extern {
pub type Generator;
/// The return() method returns the given value and finishes the generator.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator/return
#[wasm_bindgen(method, structural, js_name = return)]
pub fn gen_return(this: &Generator, value: &JsValue) -> JsValue;
/// The next() method returns an object with two properties done and value.
/// You can also provide a parameter to the next method to send a value to the generator.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator/next
#[wasm_bindgen(method, structural)]
pub fn next(this: &Generator, value: &JsValue) -> JsValue;
#[wasm_bindgen(method, structural, catch)]
pub fn next(this: &Generator, value: &JsValue) -> Result<JsValue, JsValue>;
/// The return() method returns the given value and finishes the generator.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator/return
#[wasm_bindgen(method, structural, js_name = return)]
pub fn return_(this: &Generator, value: &JsValue) -> JsValue;
/// The throw() method resumes the execution of a generator by throwing an error into it
/// and returns an object with two properties done and value.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator/throw
#[wasm_bindgen(method, structural)]
pub fn throw(this: &Generator, error: &Error) -> JsValue;
#[wasm_bindgen(method, structural, catch)]
pub fn throw(this: &Generator, error: &Error) -> Result<JsValue, JsValue>;
}
// Map