rive_rs/bones/
skinnable.rs

1// Copyright 2021 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use std::fmt;
6
7use crate::bones::Skin;
8use crate::core::{Object, ObjectRef};
9use crate::shapes::PointsPath;
10
11pub fn try_from(core: Object) -> Option<Object> {
12    core.try_cast::<PointsPath>().map(|object| object.into())
13}
14
15pub fn as_ref(object_ref: ObjectRef<'_>) -> impl Skinnable + '_ {
16    object_ref.cast::<PointsPath>()
17}
18
19pub trait Skinnable: fmt::Debug {
20    fn skin(&self) -> Option<Object<Skin>>;
21    fn set_skin(&self, skin: Object<Skin>);
22    fn mark_skin_dirty(&self);
23}