diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2016-05-21 16:07:06 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2016-05-21 16:08:47 +0200 |
commit | 7e06fb0c8a9d7fe1eb5aea40b6f28d4a686ec6ed (patch) | |
tree | 30118ae3030ffab7c80c8882f6a846684217efca /components/script/dom | |
parent | 1a34137ac41276239850d91073bec2c0ef2344d9 (diff) | |
download | servo-7e06fb0c8a9d7fe1eb5aea40b6f28d4a686ec6ed.tar.gz servo-7e06fb0c8a9d7fe1eb5aea40b6f28d4a686ec6ed.zip |
Fix the doc on inheritance and casting
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 8d13c104aa1..a5d8e7a707a 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -157,18 +157,18 @@ //! Inheritance and casting //! ======================= //! -//! For all DOM interfaces `Foo` in an inheritance chain, a -//! `dom::bindings::inheritance::FooCast` provides methods to cast -//! to other types in the inheritance chain. For example: +//! All DOM interfaces part of an inheritance chain (i.e. interfaces +//! that derive others or are derived from) implement the trait `Castable` +//! which provides both downcast and upcasts. //! //! ```ignore -//! # use script::dom::bindings::inheritance::{NodeCast, HTMLElementCast}; +//! # use script::dom::bindings::inheritance::Castable; //! # use script::dom::element::Element; //! # use script::dom::node::Node; //! # use script::dom::htmlelement::HTMLElement; //! fn f(element: &Element) { //! let base = element.upcast::<Node>(); -//! let derived = element.downcast::<HTMLElement>(); +//! let derived = element.downcast::<HTMLElement>().unwrap(); //! } //! ``` //! |