Skip to content

Commit b26e532

Browse files
committed
Format the source
1 parent bafd130 commit b26e532

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

unity-native-plugin/src/profiler.rs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -124,32 +124,24 @@ pub enum ProfilerMarkerEventType {
124124
pub type ProfilerMarkerId = UnityProfilerMarkerId;
125125

126126
pub struct ProfilerMarkerDesc {
127-
native: *const UnityProfilerMarkerDesc
127+
native: *const UnityProfilerMarkerDesc,
128128
}
129129

130130
impl ProfilerMarkerDesc {
131131
pub fn id(&self) -> ProfilerMarkerId {
132-
unsafe {
133-
(*self.native).id as ProfilerMarkerId
134-
}
132+
unsafe { (*self.native).id as ProfilerMarkerId }
135133
}
136134

137135
pub fn flags(&self) -> ProfilerMarkerFlags {
138-
unsafe {
139-
ProfilerMarkerFlags::from((*self.native).flags)
140-
}
136+
unsafe { ProfilerMarkerFlags::from((*self.native).flags) }
141137
}
142138

143139
pub fn category_id(&self) -> ProfilerCategoryId {
144-
unsafe {
145-
(*self.native).categoryId as ProfilerCategoryId
146-
}
140+
unsafe { (*self.native).categoryId as ProfilerCategoryId }
147141
}
148142

149143
pub fn name(&self) -> &std::ffi::CStr {
150-
unsafe {
151-
std::ffi::CStr::from_ptr((*self.native).name)
152-
}
144+
unsafe { std::ffi::CStr::from_ptr((*self.native).name) }
153145
}
154146
}
155147

@@ -184,29 +176,27 @@ pub enum ProfilerMarkerDataUnit {
184176
#[repr(C)]
185177
pub struct ProfilerMarkerData<'a> {
186178
native: UnityProfilerMarkerData,
187-
data_ref: &'a [u8]
179+
data_ref: &'a [u8],
188180
}
189181

190182
impl ProfilerMarkerData<'_> {
191183
pub fn new<'a>(data_type: ProfilerMarkerDataType, data: &'a [u8]) -> ProfilerMarkerData<'a> {
192184
unsafe {
193185
ProfilerMarkerData {
194-
native: UnityProfilerMarkerData{
186+
native: UnityProfilerMarkerData {
195187
type_: data_type as UnityProfilerMarkerDataType,
196188
reserved0: 0,
197189
reserved1: 0,
198190
size: data.len() as u32,
199191
ptr: &*(data.as_ptr() as *const ::std::os::raw::c_void),
200192
},
201-
data_ref: data
193+
data_ref: data,
202194
}
203195
}
204196
}
205197

206198
pub fn data_type(&self) -> ProfilerMarkerDataType {
207-
unsafe {
208-
std::mem::transmute(self.native.type_)
209-
}
199+
unsafe { std::mem::transmute(self.native.type_) }
210200
}
211201

212202
pub fn data(&self) -> &'_ [u8] {

0 commit comments

Comments
 (0)