@@ -122,10 +122,9 @@ pub trait Cast: ObjectType {
122
122
/// Returns `Ok(T)` if the object is an instance of `T` and `Err(self)`
123
123
/// otherwise.
124
124
///
125
- /// *NOTE*: This statically checks at compile-time if casting is possible. It is not always
126
- /// known at compile-time, whether a specific object implements an interface or not, in which case
127
- /// `upcast` would fail to compile. `dynamic_cast` can be used in these circumstances, which
128
- /// is checking the types at runtime.
125
+ /// *NOTE*: This will check at compile-time if `T` is lower down the
126
+ /// inheritance tree of `Self`, but also check at runtime if downcasting
127
+ /// is indeed possible.
129
128
///
130
129
/// # Example
131
130
///
@@ -152,10 +151,9 @@ pub trait Cast: ObjectType {
152
151
/// Returns `Some(T)` if the object is an instance of `T` and `None`
153
152
/// otherwise.
154
153
///
155
- /// *NOTE*: This statically checks at compile-time if casting is possible. It is not always
156
- /// known at compile-time, whether a specific object implements an interface or not, in which case
157
- /// `upcast` would fail to compile. `dynamic_cast` can be used in these circumstances, which
158
- /// is checking the types at runtime.
154
+ /// *NOTE*: This will check at compile-time if `T` is lower down the
155
+ /// inheritance tree of `Self`, but also check at runtime if downcasting
156
+ /// is indeed possible.
159
157
///
160
158
/// # Example
161
159
///
@@ -179,7 +177,9 @@ pub trait Cast: ObjectType {
179
177
// rustdoc-stripper-ignore-next
180
178
/// Tries to cast to an object of type `T`. This handles upcasting, downcasting
181
179
/// and casting between interface and interface implementors. All checks are performed at
182
- /// runtime, while `downcast` and `upcast` will do many checks at compile-time already.
180
+ /// runtime, while `upcast` will do many checks at compile-time already. `downcast` will
181
+ /// perform the same checks at runtime as `dynamic_cast`, but will also ensure some amount of
182
+ /// compile-time safety.
183
183
///
184
184
/// It is not always known at compile-time, whether a specific object implements an interface or
185
185
/// not, and checking has to be performed at runtime.
0 commit comments