mirror of
https://github.com/servo/servo.git
synced 2025-10-13 23:10:20 +01:00
Allow union types to be used as return values
This commit is contained in:
parent
1184b500e5
commit
7843b7b317
4 changed files with 28 additions and 8 deletions
|
@ -6,8 +6,8 @@ use dom::bindings::js::{JS, JSRef, Temporary};
|
|||
use dom::bindings::codegen::Bindings::TestBindingBinding::TestEnum;
|
||||
use dom::bindings::codegen::Bindings::TestBindingBinding::TestEnumValues::_empty;
|
||||
use dom::bindings::codegen::UnionTypes::BlobOrString::BlobOrString;
|
||||
use dom::bindings::codegen::UnionTypes::EventOrString::EventOrString;
|
||||
use dom::bindings::codegen::UnionTypes::HTMLElementOrLong::HTMLElementOrLong;
|
||||
use dom::bindings::codegen::UnionTypes::EventOrString::{EventOrString, eString};
|
||||
use dom::bindings::codegen::UnionTypes::HTMLElementOrLong::{HTMLElementOrLong, eLong};
|
||||
use dom::bindings::str::ByteString;
|
||||
use dom::bindings::utils::{Reflector, Reflectable};
|
||||
use dom::blob::Blob;
|
||||
|
@ -56,6 +56,10 @@ pub trait TestBindingMethods {
|
|||
fn SetEnumAttribute(&self, _: TestEnum) {}
|
||||
fn InterfaceAttribute(&self) -> Temporary<Blob>;
|
||||
fn SetInterfaceAttribute(&self, _: &JSRef<Blob>) {}
|
||||
fn UnionAttribute(&self) -> HTMLElementOrLong { eLong(0) }
|
||||
fn SetUnionAttribute(&self, _: HTMLElementOrLong) {}
|
||||
fn Union2Attribute(&self) -> EventOrString { eString("".to_string()) }
|
||||
fn SetUnion2Attribute(&self, _: EventOrString) {}
|
||||
fn AnyAttribute(&self, _: *mut JSContext) -> JSVal { NullValue() }
|
||||
fn SetAnyAttribute(&self, _: *mut JSContext, _: JSVal) {}
|
||||
|
||||
|
@ -88,7 +92,10 @@ pub trait TestBindingMethods {
|
|||
fn GetEnumAttributeNullable(&self) -> Option<TestEnum> { Some(_empty) }
|
||||
fn GetInterfaceAttributeNullable(&self) -> Option<Temporary<Blob>>;
|
||||
fn SetInterfaceAttributeNullable(&self, _: Option<JSRef<Blob>>) {}
|
||||
|
||||
fn GetUnionAttributeNullable(&self) -> Option<HTMLElementOrLong> { Some(eLong(0)) }
|
||||
fn SetUnionAttributeNullable(&self, _: Option<HTMLElementOrLong>) {}
|
||||
fn GetUnion2AttributeNullable(&self) -> Option<EventOrString> { Some(eString("".to_string())) }
|
||||
fn SetUnion2AttributeNullable(&self, _: Option<EventOrString>) {}
|
||||
fn ReceiveVoid(&self) -> () {}
|
||||
fn ReceiveBoolean(&self) -> bool { false }
|
||||
fn ReceiveByte(&self) -> i8 { 0 }
|
||||
|
@ -106,6 +113,8 @@ pub trait TestBindingMethods {
|
|||
fn ReceiveEnum(&self) -> TestEnum { _empty }
|
||||
fn ReceiveInterface(&self) -> Temporary<Blob>;
|
||||
fn ReceiveAny(&self, _: *mut JSContext) -> JSVal { NullValue() }
|
||||
fn ReceiveUnion(&self) -> HTMLElementOrLong { eLong(0) }
|
||||
fn ReceiveUnion2(&self) -> EventOrString { eString("".to_string()) }
|
||||
|
||||
fn ReceiveNullableBoolean(&self) -> Option<bool> { Some(false) }
|
||||
fn ReceiveNullableByte(&self) -> Option<i8> { Some(0) }
|
||||
|
@ -123,6 +132,8 @@ pub trait TestBindingMethods {
|
|||
fn ReceiveNullableEnum(&self) -> Option<TestEnum> { Some(_empty) }
|
||||
fn ReceiveNullableInterface(&self) -> Option<Temporary<Blob>>;
|
||||
fn ReceiveNullableAny(&self, _: *mut JSContext) -> Option<JSVal> { Some(NullValue()) }
|
||||
fn ReceiveNullableUnion(&self) -> Option<HTMLElementOrLong> { Some(eLong(0)) }
|
||||
fn ReceiveNullableUnion2(&self) -> Option<EventOrString> { Some(eString("".to_string())) }
|
||||
|
||||
fn PassBoolean(&self, _: bool) {}
|
||||
fn PassByte(&self, _: i8) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue