allow converting Box<dyn RRData> to Box<dyn Any> for owned downcast
This commit is contained in:
parent
7aeeec9f97
commit
ff13630b8c
@ -117,4 +117,8 @@ impl RRData for UnknownRecord {
|
||||
fn as_any(&self) -> &dyn ::std::any::Any {
|
||||
self as _
|
||||
}
|
||||
|
||||
fn as_box_any(self: Box<Self>) -> Box<dyn ::std::any::Any> {
|
||||
self as _
|
||||
}
|
||||
}
|
||||
|
@ -108,6 +108,8 @@ pub trait RRData: RRDataPacket + RRDataText + fmt::Debug + 'static {
|
||||
|
||||
fn as_any(&self) -> &dyn Any;
|
||||
|
||||
fn as_box_any(self: Box<Self>) -> Box<dyn Any>;
|
||||
|
||||
// (type, rrdata)
|
||||
fn text(&self) -> Result<(String, String)> {
|
||||
let mut buf = String::new();
|
||||
|
@ -66,6 +66,10 @@ pub fn rrdata_derive(s: synstructure::Structure) -> proc_macro2::TokenStream {
|
||||
fn as_any(&self) -> &::std::any::Any {
|
||||
self as _
|
||||
}
|
||||
|
||||
fn as_box_any(self: Box<Self>) -> Box<dyn ::std::any::Any> {
|
||||
self as _
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user