diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-05-21 09:29:58 -0700 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-05-21 09:29:58 -0700 |
commit | f1efeb00af4cbc2a63e09d7c50b603dd1fee2df5 (patch) | |
tree | dcbac7c79a77d2edcb3bb2a5818342b6612f1b42 /components | |
parent | eeea481a121449c5dfba01a7598482c07e16d428 (diff) | |
parent | 7e06fb0c8a9d7fe1eb5aea40b6f28d4a686ec6ed (diff) | |
download | servo-f1efeb00af4cbc2a63e09d7c50b603dd1fee2df5.tar.gz servo-f1efeb00af4cbc2a63e09d7c50b603dd1fee2df5.zip |
Auto merge of #11317 - nox:castable, r=mbrubeck
Fix the doc on inheritance and casting
<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11317)
<!-- Reviewable:end -->
Diffstat (limited to 'components')
-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(); //! } //! ``` //! |