pub struct Bone { /* private fields */ }
Expand description

A bone within the Skeleton hierarchy.

Spine API Reference

Bones can be acquired from a Skeleton and a safe BoneHandle can be obtained using the handle method to store long-term references to a specific bone.

The hierarchy can be traversed using parent and children, and specific bones can be located using Skeleton::find_bone.

Implementations

An iterator over the children of this bone.

use rusty_spine::{BoneHandle, Skeleton};

fn traverse_bones(
    bone_handle: BoneHandle,
    skeleton: &Skeleton,
    ident: usize,
) {
    if let Some(bone) = bone_handle.get(skeleton) {
        println!(
            "{:ident$}{name}",
            "",
            ident = ident,
            name = bone.data().name()
        );
        for child in bone.children() {
            traverse_bones(child.handle(), skeleton, ident + 2);
        }
    }
}

// Traverse all bones in a skeleton
let root_bone = skeleton.bone_root().handle();
traverse_bones(root_bone, &skeleton, 0);

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.