// This file was automatically generated by ros2msg_to_rs (https://github.com/tier4/ros2msg_to_rs). use super::super::super::*; use super::super::*; use safe_drive::msg::common_interfaces::*; use safe_drive::msg::*; use safe_drive::rcl; pub const PLANNING: &[u8] = b"Planning\0"; extern "C" { fn example_msg__srv__AddThreeInts_Request__init(msg: *mut AddThreeIntsRequest) -> bool; fn example_msg__srv__AddThreeInts_Request__fini(msg: *mut AddThreeIntsRequest); fn example_msg__srv__AddThreeInts_Request__Sequence__init( msg: *mut AddThreeIntsRequestSeqRaw, size: usize, ) -> bool; fn example_msg__srv__AddThreeInts_Request__Sequence__fini(msg: *mut AddThreeIntsRequestSeqRaw); fn example_msg__srv__AddThreeInts_Response__init(msg: *mut AddThreeIntsResponse) -> bool; fn example_msg__srv__AddThreeInts_Response__fini(msg: *mut AddThreeIntsResponse); fn example_msg__srv__AddThreeInts_Response__Sequence__init( msg: *mut AddThreeIntsResponseSeqRaw, size: usize, ) -> bool; fn example_msg__srv__AddThreeInts_Response__Sequence__fini( msg: *mut AddThreeIntsResponseSeqRaw, ); fn rosidl_typesupport_c__get_service_type_support_handle__example_msg__srv__AddThreeInts( ) -> *const rcl::rosidl_service_type_support_t; fn rosidl_typesupport_c__get_message_type_support_handle__example_msg__srv__AddThreeInts_Request( ) -> *const rcl::rosidl_message_type_support_t; fn rosidl_typesupport_c__get_message_type_support_handle__example_msg__srv__AddThreeInts_Response( ) -> *const rcl::rosidl_message_type_support_t; } #[repr(C)] #[derive(Debug)] pub struct AddThreeIntsRequest { pub a: i64, pub b: i64, pub c: i64, } #[repr(C)] #[derive(Debug)] pub struct AddThreeIntsResponse { pub sum: i64, } impl AddThreeIntsRequest { pub fn new() -> Option { let mut msg: Self = unsafe { std::mem::MaybeUninit::zeroed().assume_init() }; if unsafe { example_msg__srv__AddThreeInts_Request__init(&mut msg) } { Some(msg) } else { None } } } impl Drop for AddThreeIntsRequest { fn drop(&mut self) { unsafe { example_msg__srv__AddThreeInts_Request__fini(self) }; } } #[repr(C)] #[derive(Debug)] struct AddThreeIntsRequestSeqRaw { data: *mut AddThreeIntsRequest, size: size_t, capacity: size_t, } /// Sequence of AddThreeIntsRequest. /// `N` is the maximum number of elements. /// If `N` is `0`, the size is unlimited. #[repr(C)] #[derive(Debug)] pub struct AddThreeIntsRequestSeq { data: *mut AddThreeIntsRequest, size: size_t, capacity: size_t, } impl AddThreeIntsRequestSeq { /// Create a sequence of. /// `N` represents the maximum number of elements. /// If `N` is `0`, the sequence is unlimited. pub fn new(size: usize) -> Option { if N != 0 && size > N { // the size exceeds in the maximum number return None; } let mut msg: AddThreeIntsRequestSeqRaw = unsafe { std::mem::MaybeUninit::zeroed().assume_init() }; if unsafe { example_msg__srv__AddThreeInts_Request__Sequence__init(&mut msg, size) } { Some(Self { data: msg.data, size: msg.size, capacity: msg.capacity, }) } else { None } } pub fn null() -> Self { let msg: AddThreeIntsRequestSeqRaw = unsafe { std::mem::MaybeUninit::zeroed().assume_init() }; Self { data: msg.data, size: msg.size, capacity: msg.capacity, } } pub fn as_slice(&self) -> &[AddThreeIntsRequest] { if self.data.is_null() { &[] } else { let s = unsafe { std::slice::from_raw_parts(self.data, self.size as _) }; s } } pub fn as_slice_mut(&mut self) -> &mut [AddThreeIntsRequest] { if self.data.is_null() { &mut [] } else { let s = unsafe { std::slice::from_raw_parts_mut(self.data, self.size as _) }; s } } pub fn iter(&self) -> std::slice::Iter<'_, AddThreeIntsRequest> { self.as_slice().iter() } pub fn iter_mut(&mut self) -> std::slice::IterMut<'_, AddThreeIntsRequest> { self.as_slice_mut().iter_mut() } pub fn len(&self) -> usize { self.as_slice().len() } pub fn is_empty(&self) -> bool { self.len() == 0 } } impl Drop for AddThreeIntsRequestSeq { fn drop(&mut self) { let mut msg = AddThreeIntsRequestSeqRaw { data: self.data, size: self.size, capacity: self.capacity, }; unsafe { example_msg__srv__AddThreeInts_Request__Sequence__fini(&mut msg) }; } } unsafe impl Send for AddThreeIntsRequestSeq {} unsafe impl Sync for AddThreeIntsRequestSeq {} impl AddThreeIntsResponse { pub fn new() -> Option { let mut msg: Self = unsafe { std::mem::MaybeUninit::zeroed().assume_init() }; if unsafe { example_msg__srv__AddThreeInts_Response__init(&mut msg) } { Some(msg) } else { None } } } impl Drop for AddThreeIntsResponse { fn drop(&mut self) { unsafe { example_msg__srv__AddThreeInts_Response__fini(self) }; } } #[repr(C)] #[derive(Debug)] struct AddThreeIntsResponseSeqRaw { data: *mut AddThreeIntsResponse, size: size_t, capacity: size_t, } /// Sequence of AddThreeIntsResponse. /// `N` is the maximum number of elements. /// If `N` is `0`, the size is unlimited. #[repr(C)] #[derive(Debug)] pub struct AddThreeIntsResponseSeq { data: *mut AddThreeIntsResponse, size: size_t, capacity: size_t, } impl AddThreeIntsResponseSeq { /// Create a sequence of. /// `N` represents the maximum number of elements. /// If `N` is `0`, the sequence is unlimited. pub fn new(size: usize) -> Option { if N != 0 && size > N { // the size exceeds in the maximum number return None; } let mut msg: AddThreeIntsResponseSeqRaw = unsafe { std::mem::MaybeUninit::zeroed().assume_init() }; if unsafe { example_msg__srv__AddThreeInts_Response__Sequence__init(&mut msg, size) } { Some(Self { data: msg.data, size: msg.size, capacity: msg.capacity, }) } else { None } } pub fn null() -> Self { let msg: AddThreeIntsResponseSeqRaw = unsafe { std::mem::MaybeUninit::zeroed().assume_init() }; Self { data: msg.data, size: msg.size, capacity: msg.capacity, } } pub fn as_slice(&self) -> &[AddThreeIntsResponse] { if self.data.is_null() { &[] } else { let s = unsafe { std::slice::from_raw_parts(self.data, self.size as _) }; s } } pub fn as_slice_mut(&mut self) -> &mut [AddThreeIntsResponse] { if self.data.is_null() { &mut [] } else { let s = unsafe { std::slice::from_raw_parts_mut(self.data, self.size as _) }; s } } pub fn iter(&self) -> std::slice::Iter<'_, AddThreeIntsResponse> { self.as_slice().iter() } pub fn iter_mut(&mut self) -> std::slice::IterMut<'_, AddThreeIntsResponse> { self.as_slice_mut().iter_mut() } pub fn len(&self) -> usize { self.as_slice().len() } pub fn is_empty(&self) -> bool { self.len() == 0 } } impl Drop for AddThreeIntsResponseSeq { fn drop(&mut self) { let mut msg = AddThreeIntsResponseSeqRaw { data: self.data, size: self.size, capacity: self.capacity, }; unsafe { example_msg__srv__AddThreeInts_Response__Sequence__fini(&mut msg) }; } } unsafe impl Send for AddThreeIntsResponseSeq {} unsafe impl Sync for AddThreeIntsResponseSeq {} pub struct AddThreeInts; impl ServiceMsg for AddThreeInts { type Request = AddThreeIntsRequest; type Response = AddThreeIntsResponse; fn type_support() -> *const rcl::rosidl_service_type_support_t { unsafe { rosidl_typesupport_c__get_service_type_support_handle__example_msg__srv__AddThreeInts() } } } impl TypeSupport for AddThreeIntsRequest { fn type_support() -> *const rcl::rosidl_message_type_support_t { unsafe { rosidl_typesupport_c__get_message_type_support_handle__example_msg__srv__AddThreeInts_Request() } } } impl TypeSupport for AddThreeIntsResponse { fn type_support() -> *const rcl::rosidl_message_type_support_t { unsafe { rosidl_typesupport_c__get_message_type_support_handle__example_msg__srv__AddThreeInts_Response() } } }