Skip to content

Commit

Permalink
added 'try_apply' for &'static Path
Browse files Browse the repository at this point in the history
  • Loading branch information
feyokorenhof committed Nov 27, 2022
1 parent 963f16c commit 13c9a9b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/bevy_reflect/src/impls/std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,18 @@ impl Reflect for &'static Path {
}
}

fn try_apply(&mut self, value: &dyn Reflect) -> Result<(), ApplyError> {
let value = value.as_any();
if let Some(&value) = value.downcast_ref::<Self>() {
*self = value;
} else {
return Err(ApplyError::WrongType(
std::any::type_name::<Self>().to_string(),
));
}
Ok(())
}

fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
Expand Down

0 comments on commit 13c9a9b

Please sign in to comment.