mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-17 00:13:17 +00:00
Fix type mismatch
This commit is contained in:
+17
-1
@@ -1,7 +1,7 @@
|
||||
#![allow(dead_code, missing_docs)]
|
||||
|
||||
use crate::Channel;
|
||||
use bstr::{BStr, BString, ByteSlice};
|
||||
use bstr::{BStr, BString, ByteSlice, Utf8Error};
|
||||
use smallvec::SmallVec;
|
||||
use std::{
|
||||
cmp::{Ordering, PartialEq, PartialOrd},
|
||||
@@ -62,6 +62,16 @@ impl JointData {
|
||||
name.as_bytes()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn name_str(&self) -> Result<&str, Utf8Error> {
|
||||
let name = match *self {
|
||||
JointData::Root { ref name, .. } => name,
|
||||
JointData::Child { ref name, .. } => name,
|
||||
};
|
||||
|
||||
name.as_str()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) const fn offset(&self) -> &Offset {
|
||||
match *self {
|
||||
@@ -213,9 +223,15 @@ pub(crate) type JointNameInner = SmallVec<[u8; mem::size_of::<String>()]>;
|
||||
pub(crate) struct JointName(pub(crate) JointNameInner);
|
||||
|
||||
impl JointName {
|
||||
#[inline]
|
||||
pub(crate) fn as_bytes(&self) -> &[u8] {
|
||||
self.as_ref()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn as_str(&self) -> Result<&str, Utf8Error> {
|
||||
self.as_bytes().to_str()
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for JointName {
|
||||
|
||||
@@ -535,7 +535,11 @@ mod tests {
|
||||
channels: &[ChannelType],
|
||||
end_site: O,
|
||||
) {
|
||||
assert_eq!(joint.name(), expected_name);
|
||||
let name = match joint.name_str() {
|
||||
Ok(name) => name,
|
||||
Err(err) => panic!("{err}"),
|
||||
};
|
||||
assert_eq!(name, expected_name);
|
||||
assert_eq!(*joint.offset(), expected_offset);
|
||||
for (chan, expected_chan) in joint
|
||||
.channels()
|
||||
|
||||
Reference in New Issue
Block a user