-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from plule/ref_naming
Add the -Ref suffix to the reference structure, implement Copy
- Loading branch information
Showing
41 changed files
with
296 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
use derive_deref::Deref; | ||
use leap_sys::LEAP_BONE; | ||
|
||
use crate::{LeapVector, Quaternion}; | ||
use crate::{LeapVectorRef, QuaternionRef}; | ||
|
||
#[doc = " Describes a bone's position and orientation."] | ||
#[doc = ""] | ||
#[doc = " Bones are members of the LEAP_DIGIT struct."] | ||
#[doc = " @since 3.0.0"] | ||
#[derive(Deref)] | ||
pub struct Bone<'a>(pub(crate) &'a LEAP_BONE); | ||
#[derive(Deref, Clone, Copy)] | ||
pub struct BoneRef<'a>(pub(crate) &'a LEAP_BONE); | ||
|
||
impl<'a> Bone<'a> { | ||
impl<'a> BoneRef<'a> { | ||
#[doc = " The base of the bone, closer to the heart. The bones origin. @since 3.0.0"] | ||
pub fn prev_joint(&self) -> LeapVector { | ||
LeapVector::from(&self.prev_joint) | ||
pub fn prev_joint(&self) -> LeapVectorRef { | ||
LeapVectorRef::from(&self.prev_joint) | ||
} | ||
|
||
#[doc = " The end of the bone, further from the heart. @since 3.0.0"] | ||
pub fn next_joint(&self) -> LeapVector { | ||
LeapVector::from(&self.next_joint) | ||
pub fn next_joint(&self) -> LeapVectorRef { | ||
LeapVectorRef::from(&self.next_joint) | ||
} | ||
|
||
#[doc = " Rotation in world space from the forward direction."] | ||
#[doc = " Convert the quaternion to a matrix to derive the basis vectors."] | ||
#[doc = " @since 3.1.2"] | ||
pub fn rotation(&self) -> Quaternion { | ||
Quaternion::from(&self.rotation) | ||
pub fn rotation(&self) -> QuaternionRef { | ||
QuaternionRef::from(&self.rotation) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
use derive_deref::Deref; | ||
use leap_sys::LEAP_CONNECTION_MESSAGE; | ||
|
||
use crate::event::Event; | ||
use crate::event::EventRef; | ||
|
||
#[doc = " Defines a basic message from the LeapC message queue."] | ||
#[doc = " Set by calling LeapPollConnection()."] | ||
#[doc = " @since 3.0.0"] | ||
#[derive(Deref)] | ||
#[derive(Deref, Clone, Copy)] | ||
pub struct ConnectionMessage(pub(crate) LEAP_CONNECTION_MESSAGE); | ||
|
||
impl ConnectionMessage { | ||
#[doc = " A pointer to the event data for the current type of message. @since 3.0.0"] | ||
pub fn event(&self) -> Event { | ||
pub fn event(&self) -> EventRef { | ||
(self.type_, &self.__bindgen_anon_1).into() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.