make constructors public

This commit is contained in:
Cassandra de la Cruz-Munoz 2024-01-01 12:09:38 -05:00
parent 44608ba082
commit 2c5f0b8f3a
Signed by: cassdlcm
GPG Key ID: BFEBACEA812DDA70

View File

@ -113,7 +113,7 @@ pub enum MessageCreationErr {
}
#[derive(Debug)]
struct VmcExtOk {
pub struct VmcExtOk {
loaded: i32,
calibration_state: Option<i32>,
calibration_mode: Option<i32>,
@ -203,7 +203,7 @@ impl VmcMessage for VmcExtOk {
}
impl VmcExtOk {
fn new(loaded: i32, calibration_state: Option<i32>, calibration_mode: Option<i32>, tracking_status: Option<i32>) -> Result<Self, MessageCreationErr> {
pub fn new(loaded: i32, calibration_state: Option<i32>, calibration_mode: Option<i32>, tracking_status: Option<i32>) -> Result<Self, MessageCreationErr> {
if loaded < 0 || loaded > 1 {
return Err(MessageCreationErr::IntRange(CreateIntRangeErr { expected_lower: 0, expected_upper: 1, actual: loaded, calling_func: String::from("VmcExtOk::new"), arg_name: String::from("loaded")}));
}
@ -236,7 +236,7 @@ impl VmcExtOk {
}
return Ok(Self { loaded, calibration_state: None, calibration_mode: None, tracking_status: None})
}
fn new_vmc_message(loaded: i32, calibration_state: Option<i32>, calibration_mode: Option<i32>, tracking_status: Option<i32>) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
pub fn new_vmc_message(loaded: i32, calibration_state: Option<i32>, calibration_mode: Option<i32>, tracking_status: Option<i32>) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
let msg = Self::new(loaded, calibration_state, calibration_mode, tracking_status);
if msg.is_ok() {
let boxed_result: Box<dyn VmcMessage> = Box::new(msg.ok().unwrap());
@ -247,7 +247,7 @@ impl VmcExtOk {
}
#[derive(Debug)]
struct VmcExtT {
pub struct VmcExtT {
time: f32,
}
@ -276,10 +276,10 @@ impl VmcMessage for VmcExtT {
}
impl VmcExtT {
fn new(time: f32) -> Result<Self, MessageCreationErr> {
pub fn new(time: f32) -> Result<Self, MessageCreationErr> {
return Ok(Self { time });
}
fn new_vmc_message(time: f32) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
pub fn new_vmc_message(time: f32) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
let msg = Self::new(time);
if msg.is_ok() {
let boxed_result: Box<dyn VmcMessage> = Box::new(msg.ok().unwrap());
@ -290,7 +290,7 @@ impl VmcExtT {
}
#[derive(Debug)]
struct VmcExtRootPos {
pub struct VmcExtRootPos {
name: String,
transform: Transform3D,
mr_scale: Option<Vector3>,
@ -420,7 +420,7 @@ impl VmcMessage for VmcExtRootPos {
}
impl VmcExtRootPos {
fn new(name: String, transform: Transform3D, mr_scale: Option<Vector3>, mr_offset: Option<Vector3>) -> Result<Self, MessageCreationErr> {
pub fn new(name: String, transform: Transform3D, mr_scale: Option<Vector3>, mr_offset: Option<Vector3>) -> Result<Self, MessageCreationErr> {
if mr_scale.is_some() && mr_offset.is_none() {
return Err(MessageCreationErr::OptionalArgs(CreateOptionalArgsErr { expected_sets: vec![String::from("None"), String::from("mr_scale, mr_offset")], actual: String::from("mr_scale"), calling_func: String::from("VmcExtRootPos::new")}));
}
@ -429,7 +429,7 @@ impl VmcExtRootPos {
}
return Ok(Self { name, transform, mr_scale, mr_offset});
}
fn new_vmc_message(name: String, transform: Transform3D, mr_scale: Option<Vector3>, mr_offset: Option<Vector3>) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
pub fn new_vmc_message(name: String, transform: Transform3D, mr_scale: Option<Vector3>, mr_offset: Option<Vector3>) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
let message = Self::new(name, transform, mr_scale, mr_offset);
if message.is_ok() {
let boxed_result: Box<dyn VmcMessage> = Box::new(message.ok().unwrap());
@ -440,7 +440,7 @@ impl VmcExtRootPos {
}
#[derive(Debug)]
struct VmcExtBonePos {
pub struct VmcExtBonePos {
name: String,
transform: Transform3D,
}
@ -518,10 +518,10 @@ impl VmcMessage for VmcExtBonePos {
}
impl VmcExtBonePos {
fn new(name: String, transform: Transform3D) -> Result<Self, MessageCreationErr> {
pub fn new(name: String, transform: Transform3D) -> Result<Self, MessageCreationErr> {
return Ok(Self{name, transform});
}
fn new_vmc_message(name: String, transform: Transform3D) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
pub fn new_vmc_message(name: String, transform: Transform3D) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
let message = Self::new(name, transform);
if message.is_ok() {
let boxed_result: Box<dyn VmcMessage> = Box::new(message.ok().unwrap());
@ -532,7 +532,7 @@ impl VmcExtBonePos {
}
#[derive(Debug)]
struct VmcExtBlendVal {
pub struct VmcExtBlendVal {
name: String,
value: f32,
}
@ -570,10 +570,10 @@ impl VmcMessage for VmcExtBlendVal {
}
impl VmcExtBlendVal {
fn new(name: String, value: f32) -> Result<Self, MessageCreationErr> {
pub fn new(name: String, value: f32) -> Result<Self, MessageCreationErr> {
return Ok(Self{name, value});
}
fn new_vmc_message(name: String, value: f32) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
pub fn new_vmc_message(name: String, value: f32) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
let message = Self::new(name, value);
if message.is_ok() {
let boxed_result: Box<dyn VmcMessage> = Box::new(message.ok().unwrap());