Trait script::dom::bindings::inheritance::Castable

source ·
pub trait Castable: IDLInterface + DomObject + Sized {
    // Provided methods
    fn is<T>(&self) -> bool
       where T: DerivedFrom<Self> { ... }
    fn upcast<T>(&self) -> &T
       where T: Castable,
             Self: DerivedFrom<T> { ... }
    fn downcast<T>(&self) -> Option<&T>
       where T: DerivedFrom<Self> { ... }
}
Expand description

A trait to hold the cast functions of IDL interfaces that either derive or are derived from other interfaces.

Provided Methods§

source

fn is<T>(&self) -> bool
where T: DerivedFrom<Self>,

Check whether a DOM object implements one of its deriving interfaces.

source

fn upcast<T>(&self) -> &T
where T: Castable, Self: DerivedFrom<T>,

Cast a DOM object upwards to one of the interfaces it derives from.

source

fn downcast<T>(&self) -> Option<&T>
where T: DerivedFrom<Self>,

Cast a DOM object downwards to one of the interfaces it might implement.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Castable for AbstractRange

source§

impl Castable for AnalyserNode

source§

impl Castable for AnimationEvent

source§

impl Castable for Attr

source§

impl Castable for AudioBufferSourceNode

source§

impl Castable for AudioContext

source§

impl Castable for AudioDestinationNode

source§

impl Castable for AudioNode

source§

impl Castable for AudioScheduledSourceNode

source§

impl Castable for AudioTrackList

source§

impl Castable for BaseAudioContext

source§

impl Castable for BeforeUnloadEvent

source§

impl Castable for BiquadFilterNode

source§

impl Castable for Blob

source§

impl Castable for Bluetooth

source§

impl Castable for BluetoothAdvertisingEvent

source§

impl Castable for BluetoothDevice

source§

impl Castable for BluetoothPermissionResult

source§

impl Castable for BluetoothRemoteGATTCharacteristic

source§

impl Castable for BluetoothRemoteGATTService

source§

impl Castable for BroadcastChannel

source§

impl Castable for CDATASection

source§

impl Castable for ChannelMergerNode

source§

impl Castable for ChannelSplitterNode

source§

impl Castable for CharacterData

source§

impl Castable for CloseEvent

source§

impl Castable for Comment

source§

impl Castable for CompositionEvent

source§

impl Castable for ConstantSourceNode

source§

impl Castable for CSSConditionRule

source§

impl Castable for CSSFontFaceRule

source§

impl Castable for CSSGroupingRule

source§

impl Castable for CSSImportRule

source§

impl Castable for CSSKeyframeRule

source§

impl Castable for CSSKeyframesRule

source§

impl Castable for CSSLayerBlockRule

source§

impl Castable for CSSLayerStatementRule

source§

impl Castable for CSSMediaRule

source§

impl Castable for CSSNamespaceRule

source§

impl Castable for CSSRule

source§

impl Castable for CSSStyleRule

source§

impl Castable for CSSStyleSheet

source§

impl Castable for CSSSupportsRule

source§

impl Castable for CustomEvent

source§

impl Castable for DedicatedWorkerGlobalScope

source§

impl Castable for DissimilarOriginWindow

source§

impl Castable for Document

source§

impl Castable for DocumentFragment

source§

impl Castable for DocumentType

source§

impl Castable for DOMException

source§

impl Castable for DOMMatrix

source§

impl Castable for DOMMatrixReadOnly

source§

impl Castable for DOMPoint

source§

impl Castable for DOMPointReadOnly

source§

impl Castable for DOMRect

source§

impl Castable for DOMRectReadOnly

source§

impl Castable for Element

source§

impl Castable for ErrorEvent

source§

impl Castable for Event

source§

impl Castable for EventSource

source§

impl Castable for EventTarget

source§

impl Castable for ExtendableEvent

source§

impl Castable for ExtendableMessageEvent

source§

impl Castable for File

source§

impl Castable for FileReader

source§

impl Castable for FocusEvent

source§

impl Castable for FontFaceSet

source§

impl Castable for FormDataEvent

source§

impl Castable for GainNode

source§

impl Castable for GamepadEvent

source§

impl Castable for GlobalScope

source§

impl Castable for GPUDevice

source§

impl Castable for GPUError

source§

impl Castable for GPUInternalError

source§

impl Castable for GPUOutOfMemoryError

source§

impl Castable for GPUPipelineError

source§

impl Castable for GPUUncapturedErrorEvent

source§

impl Castable for GPUValidationError

source§

impl Castable for HashChangeEvent

source§

impl Castable for HTMLAnchorElement

source§

impl Castable for HTMLAreaElement

source§

impl Castable for HTMLAudioElement

source§

impl Castable for HTMLBaseElement

source§

impl Castable for HTMLBodyElement

source§

impl Castable for HTMLBRElement

source§

impl Castable for HTMLButtonElement

source§

impl Castable for HTMLCanvasElement

source§

impl Castable for HTMLCollection

source§

impl Castable for HTMLDataElement

source§

impl Castable for HTMLDataListElement

source§

impl Castable for HTMLDetailsElement

source§

impl Castable for HTMLDialogElement

source§

impl Castable for HTMLDirectoryElement

source§

impl Castable for HTMLDivElement

source§

impl Castable for HTMLDListElement

source§

impl Castable for HTMLElement

source§

impl Castable for HTMLEmbedElement

source§

impl Castable for HTMLFieldSetElement

source§

impl Castable for HTMLFontElement

source§

impl Castable for HTMLFormControlsCollection

source§

impl Castable for HTMLFormElement

source§

impl Castable for HTMLFrameElement

source§

impl Castable for HTMLFrameSetElement

source§

impl Castable for HTMLHeadElement

source§

impl Castable for HTMLHeadingElement

source§

impl Castable for HTMLHRElement

source§

impl Castable for HTMLHtmlElement

source§

impl Castable for HTMLIFrameElement

source§

impl Castable for HTMLImageElement

source§

impl Castable for HTMLInputElement

source§

impl Castable for HTMLLabelElement

source§

impl Castable for HTMLLegendElement

source§

impl Castable for HTMLLIElement

source§

impl Castable for HTMLLinkElement

source§

impl Castable for HTMLMapElement

source§

impl Castable for HTMLMediaElement

source§

impl Castable for HTMLMenuElement

source§

impl Castable for HTMLMetaElement

source§

impl Castable for HTMLMeterElement

source§

impl Castable for HTMLModElement

source§

impl Castable for HTMLObjectElement

source§

impl Castable for HTMLOListElement

source§

impl Castable for HTMLOptGroupElement

source§

impl Castable for HTMLOptionElement

source§

impl Castable for HTMLOptionsCollection

source§

impl Castable for HTMLOutputElement

source§

impl Castable for HTMLParagraphElement

source§

impl Castable for HTMLParamElement

source§

impl Castable for HTMLPictureElement

source§

impl Castable for HTMLPreElement

source§

impl Castable for HTMLProgressElement

source§

impl Castable for HTMLQuoteElement

source§

impl Castable for HTMLScriptElement

source§

impl Castable for HTMLSelectElement

source§

impl Castable for HTMLSourceElement

source§

impl Castable for HTMLSpanElement

source§

impl Castable for HTMLStyleElement

source§

impl Castable for HTMLTableCaptionElement

source§

impl Castable for HTMLTableCellElement

source§

impl Castable for HTMLTableColElement

source§

impl Castable for HTMLTableElement

source§

impl Castable for HTMLTableRowElement

source§

impl Castable for HTMLTableSectionElement

source§

impl Castable for HTMLTemplateElement

source§

impl Castable for HTMLTextAreaElement

source§

impl Castable for HTMLTimeElement

source§

impl Castable for HTMLTitleElement

source§

impl Castable for HTMLTrackElement

source§

impl Castable for HTMLUListElement

source§

impl Castable for HTMLUnknownElement

source§

impl Castable for HTMLVideoElement

source§

impl Castable for IIRFilterNode

source§

impl Castable for InputEvent

source§

impl Castable for KeyboardEvent

source§

impl Castable for MediaDevices

source§

impl Castable for MediaElementAudioSourceNode

source§

impl Castable for MediaQueryList

source§

impl Castable for MediaQueryListEvent

source§

impl Castable for MediaStream

source§

impl Castable for MediaStreamAudioDestinationNode

source§

impl Castable for MediaStreamAudioSourceNode

source§

impl Castable for MediaStreamTrack

source§

impl Castable for MediaStreamTrackAudioSourceNode

source§

impl Castable for MessageEvent

source§

impl Castable for MessagePort

source§

impl Castable for MouseEvent

source§

impl Castable for Node

source§

impl Castable for NodeList

source§

impl Castable for OfflineAudioCompletionEvent

source§

impl Castable for OfflineAudioContext

source§

impl Castable for OffscreenCanvas

source§

impl Castable for OscillatorNode

source§

impl Castable for PageTransitionEvent

source§

impl Castable for PaintWorkletGlobalScope

source§

impl Castable for PannerNode

source§

impl Castable for Performance

source§

impl Castable for PerformanceEntry

source§

impl Castable for PerformanceMark

source§

impl Castable for PerformanceMeasure

source§

impl Castable for PerformanceNavigationTiming

source§

impl Castable for PerformancePaintTiming

source§

impl Castable for PerformanceResourceTiming

source§

impl Castable for PermissionStatus

source§

impl Castable for PopStateEvent

source§

impl Castable for ProcessingInstruction

source§

impl Castable for ProgressEvent

source§

impl Castable for PromiseRejectionEvent

source§

impl Castable for RadioNodeList

source§

impl Castable for Range

source§

impl Castable for RTCDataChannel

source§

impl Castable for RTCDataChannelEvent

source§

impl Castable for RTCError

source§

impl Castable for RTCErrorEvent

source§

impl Castable for RTCPeerConnection

source§

impl Castable for RTCPeerConnectionIceEvent

source§

impl Castable for RTCTrackEvent

source§

impl Castable for SecurityPolicyViolationEvent

source§

impl Castable for ServiceWorker

source§

impl Castable for ServiceWorkerContainer

source§

impl Castable for ServiceWorkerGlobalScope

source§

impl Castable for ServiceWorkerRegistration

source§

impl Castable for ShadowRoot

source§

impl Castable for StaticRange

source§

impl Castable for StereoPannerNode

source§

impl Castable for StorageEvent

source§

impl Castable for StyleSheet

source§

impl Castable for SubmitEvent

source§

impl Castable for SVGElement

source§

impl Castable for SVGGraphicsElement

source§

impl Castable for SVGSVGElement

source§

impl Castable for TestBinding

source§

impl Castable for TestBindingProxy

source§

impl Castable for TestWorkletGlobalScope

source§

impl Castable for Text

source§

impl Castable for TextTrack

source§

impl Castable for TextTrackCue

source§

impl Castable for TextTrackList

source§

impl Castable for TouchEvent

source§

impl Castable for TrackEvent

source§

impl Castable for TransitionEvent

source§

impl Castable for UIEvent

source§

impl Castable for VideoTrackList

source§

impl Castable for VisibilityStateEntry

source§

impl Castable for VTTCue

source§

impl Castable for WebGLBuffer

source§

impl Castable for WebGLContextEvent

source§

impl Castable for WebGLFramebuffer

source§

impl Castable for WebGLObject

source§

impl Castable for WebGLProgram

source§

impl Castable for WebGLQuery

source§

impl Castable for WebGLRenderbuffer

source§

impl Castable for WebGLSampler

source§

impl Castable for WebGLShader

source§

impl Castable for WebGLSync

source§

impl Castable for WebGLTexture

source§

impl Castable for WebGLTransformFeedback

source§

impl Castable for WebGLVertexArrayObject

source§

impl Castable for WebGLVertexArrayObjectOES

source§

impl Castable for WebSocket

source§

impl Castable for WheelEvent

source§

impl Castable for Window

source§

impl Castable for Worker

source§

impl Castable for WorkerGlobalScope

source§

impl Castable for WorkletGlobalScope

source§

impl Castable for XMLDocument

source§

impl Castable for XMLHttpRequest

source§

impl Castable for XMLHttpRequestEventTarget

source§

impl Castable for XMLHttpRequestUpload

source§

impl Castable for XRBoundedReferenceSpace

source§

impl Castable for XRCompositionLayer

source§

impl Castable for XRCubeLayer

source§

impl Castable for XRCylinderLayer

source§

impl Castable for XREquirectLayer

source§

impl Castable for XRInputSourceEvent

source§

impl Castable for XRInputSourcesChangeEvent

source§

impl Castable for XRJointPose

source§

impl Castable for XRJointSpace

source§

impl Castable for XRLayer

source§

impl Castable for XRLayerEvent

source§

impl Castable for XRPose

source§

impl Castable for XRProjectionLayer

source§

impl Castable for XRQuadLayer

source§

impl Castable for XRReferenceSpace

source§

impl Castable for XRReferenceSpaceEvent

source§

impl Castable for XRSession

source§

impl Castable for XRSessionEvent

source§

impl Castable for XRSpace

source§

impl Castable for XRSubImage

source§

impl Castable for XRSystem

source§

impl Castable for XRViewerPose

source§

impl Castable for XRWebGLLayer

source§

impl Castable for XRWebGLSubImage