1#![allow(dead_code, unused_imports, unused_variables, non_camel_case_types, unused_parens)]
2
3use emboss_runtime::prelude::*;
4pub use emboss_runtime::{BitFlag, Error, Flag, InfallibleRead, Int, MutStorage, Storage, TryRead, TryWrite, UInt, View, VirtualField};
5
6
7
8pub struct BasicL2capHeader<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
9 storage: S,
10 _marker: core::marker::PhantomData<ST>,
11}
12
13impl<S: emboss_runtime::Storage> BasicL2capHeader<S, emboss_runtime::UncheckedState> {
14 pub fn new(storage: S) -> Self {
15 Self {
16 storage,
17 _marker: core::marker::PhantomData,
18 }
19 }
20}
21
22impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for BasicL2capHeader<S, ST> {
23 fn clone(&self) -> Self {
24 Self {
25 storage: self.storage.clone(),
26 _marker: core::marker::PhantomData,
27 }
28 }
29}
30
31impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> BasicL2capHeader<S, ST> {
32 pub unsafe fn new_in_state(storage: S) -> Self {
40 Self {
41 storage,
42 _marker: core::marker::PhantomData,
43 }
44 }
45 pub fn into_storage(self) -> S {
46 self.storage
47 }
48 pub fn pdu_length(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
49 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
50 let offset = (0) as usize;
51 let len = (2) as usize;
52 core::result::Result::Ok((offset, len))
53 })().unwrap_or((usize::MAX, 0));
54 let storage = self.storage.slice(offset, len);
55 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
56 }
57 pub fn channel_id(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
58 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
59 let offset = (2) as usize;
60 let len = (2) as usize;
61 core::result::Result::Ok((offset, len))
62 })().unwrap_or((usize::MAX, 0));
63 let storage = self.storage.slice(offset, len);
64 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
65 }
66
67}
68
69pub struct BasicL2capHeaderMut<S: emboss_runtime::MutStorage> {
70 storage: S,
71}
72
73impl<S: emboss_runtime::MutStorage> BasicL2capHeaderMut<S> {
74 pub fn new(storage: S) -> Self {
75 Self {
76 storage,
77 }
78 }
79 pub fn into_writer(self) -> BasicL2capHeaderWriter<S, emboss_runtime::UncheckedState> {
80 BasicL2capHeaderWriter::new(self.storage)
81 }
82 pub fn as_view(&self) -> BasicL2capHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
84 unsafe { BasicL2capHeader::new_in_state(self.storage.slice(0, self.storage.len())) }
85 }
86 pub fn pdu_length(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
87 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
88 let offset = (0) as usize;
89 let len = (2) as usize;
90 core::result::Result::Ok((offset, len))
91 })().unwrap_or((usize::MAX, 0));
92 let storage = self.storage.slice_mut(offset, len);
93 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
94 }
95 pub fn channel_id(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
96 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
97 let offset = (2) as usize;
98 let len = (2) as usize;
99 core::result::Result::Ok((offset, len))
100 })().unwrap_or((usize::MAX, 0));
101 let storage = self.storage.slice_mut(offset, len);
102 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
103 }
104
105}
106
107impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for BasicL2capHeaderMut<S> {
108 type Writer = BasicL2capHeaderWriter<S, emboss_runtime::UncheckedState>;
109 fn into_writer(self) -> Self::Writer {
110 BasicL2capHeaderWriter::new(self.storage)
111 }
112}
113
114pub struct BasicL2capHeaderWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
115 storage: S,
116 _marker: core::marker::PhantomData<ST>,
117}
118
119impl<S: emboss_runtime::MutStorage> BasicL2capHeaderWriter<S, emboss_runtime::UncheckedState> {
120 pub fn new(storage: S) -> Self {
121 Self {
122 storage,
123 _marker: core::marker::PhantomData,
124 }
125 }
126}
127
128impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> BasicL2capHeaderWriter<S, ST> {
129 pub unsafe fn new_in_state(storage: S) -> Self {
137 Self {
138 storage,
139 _marker: core::marker::PhantomData,
140 }
141 }
142 pub fn into_storage(self) -> S {
143 self.storage
144 }
145 pub fn into_view(self) -> BasicL2capHeader<S, ST> {
147 unsafe { BasicL2capHeader::new_in_state(self.storage) }
148 }
149 pub fn as_view(&self) -> BasicL2capHeader<S::Sliced<'_>, ST> {
151 unsafe { BasicL2capHeader::new_in_state(self.storage.slice(0, self.storage.len())) }
152 }
153 pub fn write_pdu_length(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> BasicL2capHeaderWriter<S, ST::OnValidMutation> {
154 let view = self.into_view();
155 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
156 let offset = (0) as usize;
157 let len = (2) as usize;
158 core::result::Result::Ok((offset, len))
159 })().expect("valid layout in complete state");
160 let mut storage = view.into_storage();
161 {
162 let slice = storage.slice_mut(offset, len);
163 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
164 field_view.try_write(val).expect("valid write in complete state");
165 }
166 unsafe { BasicL2capHeaderWriter::new_in_state(storage) }
167 }
168 pub fn write_channel_id(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> BasicL2capHeaderWriter<S, ST::OnValidMutation> {
169 let view = self.into_view();
170 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
171 let offset = (2) as usize;
172 let len = (2) as usize;
173 core::result::Result::Ok((offset, len))
174 })().expect("valid layout in complete state");
175 let mut storage = view.into_storage();
176 {
177 let slice = storage.slice_mut(offset, len);
178 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
179 field_view.try_write(val).expect("valid write in complete state");
180 }
181 unsafe { BasicL2capHeaderWriter::new_in_state(storage) }
182 }
183
184}
185
186impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for BasicL2capHeader<S, ST> {
187 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
188 let view = self;
189 core::result::Result::Ok((4) as usize)
190 }
191}
192
193impl<S: emboss_runtime::MutStorage> emboss_runtime::View for BasicL2capHeaderMut<S> {
194 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
195 let view = self.as_view();
196 <BasicL2capHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
197 }
198}
199
200impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for BasicL2capHeaderWriter<S, ST> {
201 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
202 let view = self.as_view();
203 <BasicL2capHeader<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
204 }
205}
206
207impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for BasicL2capHeader<S, emboss_runtime::UncheckedState> {
208 type Completed = BasicL2capHeader<S, emboss_runtime::CompleteState>;
209 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
210 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
211 if self.storage.len() < required_size {
212 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
213 }
214 core::result::Result::Ok(unsafe { BasicL2capHeader::new_in_state(self.storage) })
215 }
216}
217
218impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for BasicL2capHeaderWriter<S, emboss_runtime::UncheckedState> {
219 type Completed = BasicL2capHeaderWriter<S, emboss_runtime::CompleteState>;
220 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
221 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
222 if self.storage.len() < required_size {
223 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
224 }
225 core::result::Result::Ok(unsafe { BasicL2capHeaderWriter::new_in_state(self.storage) })
226 }
227}
228
229impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for BasicL2capHeader<S, emboss_runtime::UncheckedState> {
230 type Ok = BasicL2capHeader<S, emboss_runtime::OkState>;
231 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
232 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
233 core::result::Result::Ok(unsafe { BasicL2capHeader::new_in_state(completed.into_storage()) })
234 }
235}
236
237impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for BasicL2capHeader<S, emboss_runtime::CompleteState> {
238 type Ok = BasicL2capHeader<S, emboss_runtime::OkState>;
239 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
240 core::result::Result::Ok(unsafe { BasicL2capHeader::new_in_state(self.into_storage()) })
241 }
242}
243
244impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for BasicL2capHeader<S, emboss_runtime::OkState> {
245 type Ok = BasicL2capHeader<S, emboss_runtime::OkState>;
246 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
247 core::result::Result::Ok(self)
248 }
249}
250
251impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for BasicL2capHeaderWriter<S, emboss_runtime::UncheckedState> {
252 type Ok = BasicL2capHeaderWriter<S, emboss_runtime::OkState>;
253 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
254 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
255 core::result::Result::Ok(unsafe { BasicL2capHeaderWriter::new_in_state(completed.into_storage()) })
256 }
257}
258
259impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for BasicL2capHeaderWriter<S, emboss_runtime::CompleteState> {
260 type Ok = BasicL2capHeaderWriter<S, emboss_runtime::OkState>;
261 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
262 core::result::Result::Ok(unsafe { BasicL2capHeaderWriter::new_in_state(self.into_storage()) })
263 }
264}
265
266impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for BasicL2capHeaderWriter<S, emboss_runtime::OkState> {
267 type Ok = BasicL2capHeaderWriter<S, emboss_runtime::OkState>;
268 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
269 core::result::Result::Ok(self)
270 }
271}
272
273pub mod basic_l2cap_header {
274 pub type View<S, ST = emboss_runtime::UncheckedState> = super::BasicL2capHeader<S, ST>;
275 pub type ViewMut<S> = super::BasicL2capHeaderMut<S>;
276 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::BasicL2capHeaderWriter<S, ST>;
277
278 pub const MIN_SIZE_IN_BYTES: usize = 4;
279 pub const MAX_SIZE_IN_BYTES: usize = 4;
280 pub const SIZE_IN_BYTES: usize = 4;
281}pub struct BFrame_Payload_ArrayView<S: emboss_runtime::Storage> {
282 storage: S,
283 element_count: usize,
284}
285
286impl<S: emboss_runtime::Storage + core::clone::Clone> core::clone::Clone for BFrame_Payload_ArrayView<S> {
287 fn clone(&self) -> Self {
288 Self {
289 storage: self.storage.clone(),
290 element_count: self.element_count,
291 }
292 }
293}
294
295impl<S: emboss_runtime::Storage> BFrame_Payload_ArrayView<S> {
296 pub const ELEMENT_SIZE_BYTES: usize = 1;
297 pub fn new(storage: S, element_count: usize) -> Self {
298 Self { storage, element_count }
299 }
300 pub fn element_count(&self) -> usize {
301 self.element_count
302 }
303 pub fn get(&self, index: usize) -> core::result::Result<emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::Sliced<'_>>
304, emboss_runtime::Error> {
305 if index >= self.element_count {
306 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
307 }
308 let offset = index * Self::ELEMENT_SIZE_BYTES;
309 let storage = self.storage.slice(offset, Self::ELEMENT_SIZE_BYTES);
310 core::result::Result::Ok(emboss_runtime::UInt::new(storage)
311)
312 }
313}
314
315pub struct BFrame_Payload_ArrayViewMut<S: emboss_runtime::MutStorage> {
316 storage: S,
317 element_count: usize,
318}
319
320impl<S: emboss_runtime::MutStorage> BFrame_Payload_ArrayViewMut<S> {
321 pub const ELEMENT_SIZE_BYTES: usize = 1;
322 pub fn new(storage: S, element_count: usize) -> Self {
323 Self { storage, element_count }
324 }
325 pub fn element_count(&self) -> usize {
326 self.element_count
327 }
328 pub fn get_mut(&mut self, index: usize) -> core::result::Result<emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::SlicedMut<'_>>
329, emboss_runtime::Error> {
330 if index >= self.element_count {
331 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
332 }
333 let offset = index * Self::ELEMENT_SIZE_BYTES;
334 let storage = self.storage.slice_mut(offset, Self::ELEMENT_SIZE_BYTES);
335 core::result::Result::Ok(emboss_runtime::UInt::new(storage)
336)
337 }
338}
339pub struct BFrame<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
340 storage: S,
341 _marker: core::marker::PhantomData<ST>,
342}
343
344impl<S: emboss_runtime::Storage> BFrame<S, emboss_runtime::UncheckedState> {
345 pub fn new(storage: S) -> Self {
346 Self {
347 storage,
348 _marker: core::marker::PhantomData,
349 }
350 }
351}
352
353impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for BFrame<S, ST> {
354 fn clone(&self) -> Self {
355 Self {
356 storage: self.storage.clone(),
357 _marker: core::marker::PhantomData,
358 }
359 }
360}
361
362impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> BFrame<S, ST> {
363 pub unsafe fn new_in_state(storage: S) -> Self {
371 Self {
372 storage,
373 _marker: core::marker::PhantomData,
374 }
375 }
376 pub fn into_storage(self) -> S {
377 self.storage
378 }
379 pub fn header(&self) -> BasicL2capHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
380 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
381 let offset = (0) as usize;
382 let len = (4) as usize;
383 core::result::Result::Ok((offset, len))
384 })().unwrap_or((usize::MAX, 0));
385 let storage = self.storage.slice(offset, len);
386 unsafe { BasicL2capHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
387 }
388 pub fn pdu_length(&self) -> emboss_runtime::VirtualField<u64> {
389 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
390 core::result::Result::Ok( (({ let val = self.header().pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
391) as u64 )
392 })();
393 emboss_runtime::VirtualField::new(value)
394 }
395 pub fn channel_id(&self) -> emboss_runtime::VirtualField<u64> {
396 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
397 core::result::Result::Ok( (({ let val = self.header().channel_id().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
398) as u64 )
399 })();
400 emboss_runtime::VirtualField::new(value)
401 }
402 pub fn payload(&self) -> core::result::Result<BFrame_Payload_ArrayView<S::Sliced<'_>>, emboss_runtime::Error> {
403 let offset_res = (|| -> core::result::Result<(usize, usize, usize), emboss_runtime::Error> {
404 let offset = (4) as usize;
405 let len = (({ let val = self.pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
406) as usize;
407 let element_count = (len / (1)) as usize;
408 core::result::Result::Ok((offset, len, element_count))
409 })();
410 match offset_res {
411 core::result::Result::Ok((offset, len, element_count)) => {
412 if len > 0 {
413 let end = offset.checked_add(len).ok_or(emboss_runtime::Error::OutOfBounds)?;
414 self.storage.try_read_byte(end - 1)?;
415 }
416 let storage = self.storage.slice(offset, len);
417 core::result::Result::Ok(BFrame_Payload_ArrayView::new(storage, element_count))
418 },
419 core::result::Result::Err(e) => core::result::Result::Err(e),
420 }
421 }
422
423}
424
425pub struct BFrameMut<S: emboss_runtime::MutStorage> {
426 storage: S,
427}
428
429impl<S: emboss_runtime::MutStorage> BFrameMut<S> {
430 pub fn new(storage: S) -> Self {
431 Self {
432 storage,
433 }
434 }
435 pub fn into_writer(self) -> BFrameWriter<S, emboss_runtime::UncheckedState> {
436 BFrameWriter::new(self.storage)
437 }
438 pub fn as_view(&self) -> BFrame<S::Sliced<'_>, emboss_runtime::UncheckedState> {
440 unsafe { BFrame::new_in_state(self.storage.slice(0, self.storage.len())) }
441 }
442 pub fn header(&mut self) -> BasicL2capHeaderMut<S::SlicedMut<'_>> {
443 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
444 let offset = (0) as usize;
445 let len = (4) as usize;
446 core::result::Result::Ok((offset, len))
447 })().unwrap_or((usize::MAX, 0));
448 let storage = self.storage.slice_mut(offset, len);
449 BasicL2capHeaderMut::<S::SlicedMut<'_>>::new(storage)
450 }
451 pub fn pdu_length(&mut self) -> emboss_runtime::VirtualField<u64> {
452 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
453 core::result::Result::Ok( (({ let val = self.header().pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
454) as u64 )
455 })();
456 emboss_runtime::VirtualField::new(value)
457 }
458 pub fn channel_id(&mut self) -> emboss_runtime::VirtualField<u64> {
459 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
460 core::result::Result::Ok( (({ let val = self.header().channel_id().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
461) as u64 )
462 })();
463 emboss_runtime::VirtualField::new(value)
464 }
465 pub fn payload_mut(&mut self) -> core::result::Result<BFrame_Payload_ArrayViewMut<S::SlicedMut<'_>>, emboss_runtime::Error> {
466 let offset_res = (|| -> core::result::Result<(usize, usize, usize), emboss_runtime::Error> {
467 let offset = (4) as usize;
468 let len = (({ let val = self.pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
469) as usize;
470 let element_count = (len / (1)) as usize;
471 core::result::Result::Ok((offset, len, element_count))
472 })();
473 match offset_res {
474 core::result::Result::Ok((offset, len, element_count)) => {
475 if len > 0 {
476 let end = offset.checked_add(len).ok_or(emboss_runtime::Error::OutOfBounds)?;
477 self.storage.try_read_byte(end - 1)?;
478 }
479 let storage = self.storage.slice_mut(offset, len);
480 core::result::Result::Ok(BFrame_Payload_ArrayViewMut::new(storage, element_count))
481 },
482 core::result::Result::Err(e) => core::result::Result::Err(e),
483 }
484 }
485
486}
487
488impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for BFrameMut<S> {
489 type Writer = BFrameWriter<S, emboss_runtime::UncheckedState>;
490 fn into_writer(self) -> Self::Writer {
491 BFrameWriter::new(self.storage)
492 }
493}
494
495pub struct BFrameWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
496 storage: S,
497 _marker: core::marker::PhantomData<ST>,
498}
499
500impl<S: emboss_runtime::MutStorage> BFrameWriter<S, emboss_runtime::UncheckedState> {
501 pub fn new(storage: S) -> Self {
502 Self {
503 storage,
504 _marker: core::marker::PhantomData,
505 }
506 }
507}
508
509impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> BFrameWriter<S, ST> {
510 pub unsafe fn new_in_state(storage: S) -> Self {
518 Self {
519 storage,
520 _marker: core::marker::PhantomData,
521 }
522 }
523 pub fn into_storage(self) -> S {
524 self.storage
525 }
526 pub fn into_view(self) -> BFrame<S, ST> {
528 unsafe { BFrame::new_in_state(self.storage) }
529 }
530 pub fn as_view(&self) -> BFrame<S::Sliced<'_>, ST> {
532 unsafe { BFrame::new_in_state(self.storage.slice(0, self.storage.len())) }
533 }
534
535}
536
537impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for BFrame<S, ST> {
538 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
539 let view = self;
540 core::result::Result::Ok((core::cmp::max((core::cmp::max((0) as i64, (4) as i64)
541) as i64, ((if true { ( (4) as i64 + (({ let val = view.pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
542) as i64 )
543 } else { 0 })
544
545) as i64)
546) as usize)
547 }
548}
549
550impl<S: emboss_runtime::MutStorage> emboss_runtime::View for BFrameMut<S> {
551 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
552 let view = self.as_view();
553 <BFrame<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
554 }
555}
556
557impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for BFrameWriter<S, ST> {
558 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
559 let view = self.as_view();
560 <BFrame<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
561 }
562}
563
564impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for BFrame<S, emboss_runtime::UncheckedState> {
565 type Completed = BFrame<S, emboss_runtime::CompleteState>;
566 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
567 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
568 if self.storage.len() < required_size {
569 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
570 }
571 core::result::Result::Ok(unsafe { BFrame::new_in_state(self.storage) })
572 }
573}
574
575impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for BFrameWriter<S, emboss_runtime::UncheckedState> {
576 type Completed = BFrameWriter<S, emboss_runtime::CompleteState>;
577 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
578 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
579 if self.storage.len() < required_size {
580 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
581 }
582 core::result::Result::Ok(unsafe { BFrameWriter::new_in_state(self.storage) })
583 }
584}
585
586impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for BFrame<S, emboss_runtime::UncheckedState> {
587 type Ok = BFrame<S, emboss_runtime::OkState>;
588 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
589 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
590 core::result::Result::Ok(unsafe { BFrame::new_in_state(completed.into_storage()) })
591 }
592}
593
594impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for BFrame<S, emboss_runtime::CompleteState> {
595 type Ok = BFrame<S, emboss_runtime::OkState>;
596 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
597 core::result::Result::Ok(unsafe { BFrame::new_in_state(self.into_storage()) })
598 }
599}
600
601impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for BFrame<S, emboss_runtime::OkState> {
602 type Ok = BFrame<S, emboss_runtime::OkState>;
603 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
604 core::result::Result::Ok(self)
605 }
606}
607
608impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for BFrameWriter<S, emboss_runtime::UncheckedState> {
609 type Ok = BFrameWriter<S, emboss_runtime::OkState>;
610 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
611 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
612 core::result::Result::Ok(unsafe { BFrameWriter::new_in_state(completed.into_storage()) })
613 }
614}
615
616impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for BFrameWriter<S, emboss_runtime::CompleteState> {
617 type Ok = BFrameWriter<S, emboss_runtime::OkState>;
618 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
619 core::result::Result::Ok(unsafe { BFrameWriter::new_in_state(self.into_storage()) })
620 }
621}
622
623impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for BFrameWriter<S, emboss_runtime::OkState> {
624 type Ok = BFrameWriter<S, emboss_runtime::OkState>;
625 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
626 core::result::Result::Ok(self)
627 }
628}
629
630pub mod b_frame {
631 pub type View<S, ST = emboss_runtime::UncheckedState> = super::BFrame<S, ST>;
632 pub type ViewMut<S> = super::BFrameMut<S>;
633 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::BFrameWriter<S, ST>;
634
635 pub const MIN_SIZE_IN_BYTES: usize = 4;
636 pub const MAX_SIZE_IN_BYTES: usize = 65539;
637}pub struct BFrameHeader<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
638 storage: S,
639 _marker: core::marker::PhantomData<ST>,
640}
641
642impl<S: emboss_runtime::Storage> BFrameHeader<S, emboss_runtime::UncheckedState> {
643 pub fn new(storage: S) -> Self {
644 Self {
645 storage,
646 _marker: core::marker::PhantomData,
647 }
648 }
649}
650
651impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for BFrameHeader<S, ST> {
652 fn clone(&self) -> Self {
653 Self {
654 storage: self.storage.clone(),
655 _marker: core::marker::PhantomData,
656 }
657 }
658}
659
660impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> BFrameHeader<S, ST> {
661 pub unsafe fn new_in_state(storage: S) -> Self {
669 Self {
670 storage,
671 _marker: core::marker::PhantomData,
672 }
673 }
674 pub fn into_storage(self) -> S {
675 self.storage
676 }
677 pub fn pdu_length(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
678 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
679 let offset = (0) as usize;
680 let len = (2) as usize;
681 core::result::Result::Ok((offset, len))
682 })().unwrap_or((usize::MAX, 0));
683 let storage = self.storage.slice(offset, len);
684 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
685 }
686 pub fn channel_id(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
687 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
688 let offset = (2) as usize;
689 let len = (2) as usize;
690 core::result::Result::Ok((offset, len))
691 })().unwrap_or((usize::MAX, 0));
692 let storage = self.storage.slice(offset, len);
693 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
694 }
695
696}
697
698pub struct BFrameHeaderMut<S: emboss_runtime::MutStorage> {
699 storage: S,
700}
701
702impl<S: emboss_runtime::MutStorage> BFrameHeaderMut<S> {
703 pub fn new(storage: S) -> Self {
704 Self {
705 storage,
706 }
707 }
708 pub fn into_writer(self) -> BFrameHeaderWriter<S, emboss_runtime::UncheckedState> {
709 BFrameHeaderWriter::new(self.storage)
710 }
711 pub fn as_view(&self) -> BFrameHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
713 unsafe { BFrameHeader::new_in_state(self.storage.slice(0, self.storage.len())) }
714 }
715 pub fn pdu_length(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
716 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
717 let offset = (0) as usize;
718 let len = (2) as usize;
719 core::result::Result::Ok((offset, len))
720 })().unwrap_or((usize::MAX, 0));
721 let storage = self.storage.slice_mut(offset, len);
722 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
723 }
724 pub fn channel_id(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
725 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
726 let offset = (2) as usize;
727 let len = (2) as usize;
728 core::result::Result::Ok((offset, len))
729 })().unwrap_or((usize::MAX, 0));
730 let storage = self.storage.slice_mut(offset, len);
731 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
732 }
733
734}
735
736impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for BFrameHeaderMut<S> {
737 type Writer = BFrameHeaderWriter<S, emboss_runtime::UncheckedState>;
738 fn into_writer(self) -> Self::Writer {
739 BFrameHeaderWriter::new(self.storage)
740 }
741}
742
743pub struct BFrameHeaderWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
744 storage: S,
745 _marker: core::marker::PhantomData<ST>,
746}
747
748impl<S: emboss_runtime::MutStorage> BFrameHeaderWriter<S, emboss_runtime::UncheckedState> {
749 pub fn new(storage: S) -> Self {
750 Self {
751 storage,
752 _marker: core::marker::PhantomData,
753 }
754 }
755}
756
757impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> BFrameHeaderWriter<S, ST> {
758 pub unsafe fn new_in_state(storage: S) -> Self {
766 Self {
767 storage,
768 _marker: core::marker::PhantomData,
769 }
770 }
771 pub fn into_storage(self) -> S {
772 self.storage
773 }
774 pub fn into_view(self) -> BFrameHeader<S, ST> {
776 unsafe { BFrameHeader::new_in_state(self.storage) }
777 }
778 pub fn as_view(&self) -> BFrameHeader<S::Sliced<'_>, ST> {
780 unsafe { BFrameHeader::new_in_state(self.storage.slice(0, self.storage.len())) }
781 }
782 pub fn write_pdu_length(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> BFrameHeaderWriter<S, ST::OnValidMutation> {
783 let view = self.into_view();
784 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
785 let offset = (0) as usize;
786 let len = (2) as usize;
787 core::result::Result::Ok((offset, len))
788 })().expect("valid layout in complete state");
789 let mut storage = view.into_storage();
790 {
791 let slice = storage.slice_mut(offset, len);
792 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
793 field_view.try_write(val).expect("valid write in complete state");
794 }
795 unsafe { BFrameHeaderWriter::new_in_state(storage) }
796 }
797 pub fn write_channel_id(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> BFrameHeaderWriter<S, ST::OnValidMutation> {
798 let view = self.into_view();
799 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
800 let offset = (2) as usize;
801 let len = (2) as usize;
802 core::result::Result::Ok((offset, len))
803 })().expect("valid layout in complete state");
804 let mut storage = view.into_storage();
805 {
806 let slice = storage.slice_mut(offset, len);
807 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
808 field_view.try_write(val).expect("valid write in complete state");
809 }
810 unsafe { BFrameHeaderWriter::new_in_state(storage) }
811 }
812
813}
814
815impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for BFrameHeader<S, ST> {
816 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
817 let view = self;
818 core::result::Result::Ok((4) as usize)
819 }
820}
821
822impl<S: emboss_runtime::MutStorage> emboss_runtime::View for BFrameHeaderMut<S> {
823 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
824 let view = self.as_view();
825 <BFrameHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
826 }
827}
828
829impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for BFrameHeaderWriter<S, ST> {
830 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
831 let view = self.as_view();
832 <BFrameHeader<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
833 }
834}
835
836impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for BFrameHeader<S, emboss_runtime::UncheckedState> {
837 type Completed = BFrameHeader<S, emboss_runtime::CompleteState>;
838 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
839 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
840 if self.storage.len() < required_size {
841 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
842 }
843 core::result::Result::Ok(unsafe { BFrameHeader::new_in_state(self.storage) })
844 }
845}
846
847impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for BFrameHeaderWriter<S, emboss_runtime::UncheckedState> {
848 type Completed = BFrameHeaderWriter<S, emboss_runtime::CompleteState>;
849 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
850 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
851 if self.storage.len() < required_size {
852 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
853 }
854 core::result::Result::Ok(unsafe { BFrameHeaderWriter::new_in_state(self.storage) })
855 }
856}
857
858impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for BFrameHeader<S, emboss_runtime::UncheckedState> {
859 type Ok = BFrameHeader<S, emboss_runtime::OkState>;
860 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
861 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
862 core::result::Result::Ok(unsafe { BFrameHeader::new_in_state(completed.into_storage()) })
863 }
864}
865
866impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for BFrameHeader<S, emboss_runtime::CompleteState> {
867 type Ok = BFrameHeader<S, emboss_runtime::OkState>;
868 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
869 core::result::Result::Ok(unsafe { BFrameHeader::new_in_state(self.into_storage()) })
870 }
871}
872
873impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for BFrameHeader<S, emboss_runtime::OkState> {
874 type Ok = BFrameHeader<S, emboss_runtime::OkState>;
875 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
876 core::result::Result::Ok(self)
877 }
878}
879
880impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for BFrameHeaderWriter<S, emboss_runtime::UncheckedState> {
881 type Ok = BFrameHeaderWriter<S, emboss_runtime::OkState>;
882 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
883 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
884 core::result::Result::Ok(unsafe { BFrameHeaderWriter::new_in_state(completed.into_storage()) })
885 }
886}
887
888impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for BFrameHeaderWriter<S, emboss_runtime::CompleteState> {
889 type Ok = BFrameHeaderWriter<S, emboss_runtime::OkState>;
890 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
891 core::result::Result::Ok(unsafe { BFrameHeaderWriter::new_in_state(self.into_storage()) })
892 }
893}
894
895impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for BFrameHeaderWriter<S, emboss_runtime::OkState> {
896 type Ok = BFrameHeaderWriter<S, emboss_runtime::OkState>;
897 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
898 core::result::Result::Ok(self)
899 }
900}
901
902pub mod b_frame_header {
903 pub type View<S, ST = emboss_runtime::UncheckedState> = super::BFrameHeader<S, ST>;
904 pub type ViewMut<S> = super::BFrameHeaderMut<S>;
905 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::BFrameHeaderWriter<S, ST>;
906
907 pub const MIN_SIZE_IN_BYTES: usize = 4;
908 pub const MAX_SIZE_IN_BYTES: usize = 4;
909 pub const SIZE_IN_BYTES: usize = 4;
910}pub struct FirstKFrame_Payload_ArrayView<S: emboss_runtime::Storage> {
911 storage: S,
912 element_count: usize,
913}
914
915impl<S: emboss_runtime::Storage + core::clone::Clone> core::clone::Clone for FirstKFrame_Payload_ArrayView<S> {
916 fn clone(&self) -> Self {
917 Self {
918 storage: self.storage.clone(),
919 element_count: self.element_count,
920 }
921 }
922}
923
924impl<S: emboss_runtime::Storage> FirstKFrame_Payload_ArrayView<S> {
925 pub const ELEMENT_SIZE_BYTES: usize = 1;
926 pub fn new(storage: S, element_count: usize) -> Self {
927 Self { storage, element_count }
928 }
929 pub fn element_count(&self) -> usize {
930 self.element_count
931 }
932 pub fn get(&self, index: usize) -> core::result::Result<emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::Sliced<'_>>
933, emboss_runtime::Error> {
934 if index >= self.element_count {
935 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
936 }
937 let offset = index * Self::ELEMENT_SIZE_BYTES;
938 let storage = self.storage.slice(offset, Self::ELEMENT_SIZE_BYTES);
939 core::result::Result::Ok(emboss_runtime::UInt::new(storage)
940)
941 }
942}
943
944pub struct FirstKFrame_Payload_ArrayViewMut<S: emboss_runtime::MutStorage> {
945 storage: S,
946 element_count: usize,
947}
948
949impl<S: emboss_runtime::MutStorage> FirstKFrame_Payload_ArrayViewMut<S> {
950 pub const ELEMENT_SIZE_BYTES: usize = 1;
951 pub fn new(storage: S, element_count: usize) -> Self {
952 Self { storage, element_count }
953 }
954 pub fn element_count(&self) -> usize {
955 self.element_count
956 }
957 pub fn get_mut(&mut self, index: usize) -> core::result::Result<emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::SlicedMut<'_>>
958, emboss_runtime::Error> {
959 if index >= self.element_count {
960 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
961 }
962 let offset = index * Self::ELEMENT_SIZE_BYTES;
963 let storage = self.storage.slice_mut(offset, Self::ELEMENT_SIZE_BYTES);
964 core::result::Result::Ok(emboss_runtime::UInt::new(storage)
965)
966 }
967}
968pub struct FirstKFrame<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
969 storage: S,
970 _marker: core::marker::PhantomData<ST>,
971}
972
973impl<S: emboss_runtime::Storage> FirstKFrame<S, emboss_runtime::UncheckedState> {
974 pub fn new(storage: S) -> Self {
975 Self {
976 storage,
977 _marker: core::marker::PhantomData,
978 }
979 }
980}
981
982impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for FirstKFrame<S, ST> {
983 fn clone(&self) -> Self {
984 Self {
985 storage: self.storage.clone(),
986 _marker: core::marker::PhantomData,
987 }
988 }
989}
990
991impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> FirstKFrame<S, ST> {
992 pub unsafe fn new_in_state(storage: S) -> Self {
1000 Self {
1001 storage,
1002 _marker: core::marker::PhantomData,
1003 }
1004 }
1005 pub fn into_storage(self) -> S {
1006 self.storage
1007 }
1008 pub fn header(&self) -> BasicL2capHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
1009 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
1010 let offset = (0) as usize;
1011 let len = (4) as usize;
1012 core::result::Result::Ok((offset, len))
1013 })().unwrap_or((usize::MAX, 0));
1014 let storage = self.storage.slice(offset, len);
1015 unsafe { BasicL2capHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
1016 }
1017 pub fn pdu_length(&self) -> emboss_runtime::VirtualField<u64> {
1018 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
1019 core::result::Result::Ok( (({ let val = self.header().pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1020) as u64 )
1021 })();
1022 emboss_runtime::VirtualField::new(value)
1023 }
1024 pub fn channel_id(&self) -> emboss_runtime::VirtualField<u64> {
1025 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
1026 core::result::Result::Ok( (({ let val = self.header().channel_id().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1027) as u64 )
1028 })();
1029 emboss_runtime::VirtualField::new(value)
1030 }
1031 pub fn payload_size(&self) -> emboss_runtime::VirtualField<i64> {
1032 let value = (|| -> core::result::Result<i64, emboss_runtime::Error> {
1033 core::result::Result::Ok( (( (({ let val = self.pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1034) as i64 - (2) as i64 )
1035) as i64 )
1036 })();
1037 emboss_runtime::VirtualField::new(value)
1038 }
1039 pub fn sdu_length(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
1040 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
1041 let offset = (4) as usize;
1042 let len = (2) as usize;
1043 core::result::Result::Ok((offset, len))
1044 })().unwrap_or((usize::MAX, 0));
1045 let storage = self.storage.slice(offset, len);
1046 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
1047 }
1048 pub fn payload(&self) -> core::result::Result<FirstKFrame_Payload_ArrayView<S::Sliced<'_>>, emboss_runtime::Error> {
1049 let offset_res = (|| -> core::result::Result<(usize, usize, usize), emboss_runtime::Error> {
1050 let offset = (6) as usize;
1051 let len = (({ let val = self.payload_size().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1052) as usize;
1053 let element_count = (len / (1)) as usize;
1054 core::result::Result::Ok((offset, len, element_count))
1055 })();
1056 match offset_res {
1057 core::result::Result::Ok((offset, len, element_count)) => {
1058 if len > 0 {
1059 let end = offset.checked_add(len).ok_or(emboss_runtime::Error::OutOfBounds)?;
1060 self.storage.try_read_byte(end - 1)?;
1061 }
1062 let storage = self.storage.slice(offset, len);
1063 core::result::Result::Ok(FirstKFrame_Payload_ArrayView::new(storage, element_count))
1064 },
1065 core::result::Result::Err(e) => core::result::Result::Err(e),
1066 }
1067 }
1068
1069}
1070
1071pub struct FirstKFrameMut<S: emboss_runtime::MutStorage> {
1072 storage: S,
1073}
1074
1075impl<S: emboss_runtime::MutStorage> FirstKFrameMut<S> {
1076 pub fn new(storage: S) -> Self {
1077 Self {
1078 storage,
1079 }
1080 }
1081 pub fn into_writer(self) -> FirstKFrameWriter<S, emboss_runtime::UncheckedState> {
1082 FirstKFrameWriter::new(self.storage)
1083 }
1084 pub fn as_view(&self) -> FirstKFrame<S::Sliced<'_>, emboss_runtime::UncheckedState> {
1086 unsafe { FirstKFrame::new_in_state(self.storage.slice(0, self.storage.len())) }
1087 }
1088 pub fn header(&mut self) -> BasicL2capHeaderMut<S::SlicedMut<'_>> {
1089 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
1090 let offset = (0) as usize;
1091 let len = (4) as usize;
1092 core::result::Result::Ok((offset, len))
1093 })().unwrap_or((usize::MAX, 0));
1094 let storage = self.storage.slice_mut(offset, len);
1095 BasicL2capHeaderMut::<S::SlicedMut<'_>>::new(storage)
1096 }
1097 pub fn pdu_length(&mut self) -> emboss_runtime::VirtualField<u64> {
1098 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
1099 core::result::Result::Ok( (({ let val = self.header().pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1100) as u64 )
1101 })();
1102 emboss_runtime::VirtualField::new(value)
1103 }
1104 pub fn channel_id(&mut self) -> emboss_runtime::VirtualField<u64> {
1105 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
1106 core::result::Result::Ok( (({ let val = self.header().channel_id().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1107) as u64 )
1108 })();
1109 emboss_runtime::VirtualField::new(value)
1110 }
1111 pub fn payload_size(&mut self) -> emboss_runtime::VirtualField<i64> {
1112 let value = (|| -> core::result::Result<i64, emboss_runtime::Error> {
1113 core::result::Result::Ok( (( (({ let val = self.pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1114) as i64 - (2) as i64 )
1115) as i64 )
1116 })();
1117 emboss_runtime::VirtualField::new(value)
1118 }
1119 pub fn sdu_length(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
1120 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
1121 let offset = (4) as usize;
1122 let len = (2) as usize;
1123 core::result::Result::Ok((offset, len))
1124 })().unwrap_or((usize::MAX, 0));
1125 let storage = self.storage.slice_mut(offset, len);
1126 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
1127 }
1128 pub fn payload_mut(&mut self) -> core::result::Result<FirstKFrame_Payload_ArrayViewMut<S::SlicedMut<'_>>, emboss_runtime::Error> {
1129 let offset_res = (|| -> core::result::Result<(usize, usize, usize), emboss_runtime::Error> {
1130 let offset = (6) as usize;
1131 let len = (({ let val = self.payload_size().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1132) as usize;
1133 let element_count = (len / (1)) as usize;
1134 core::result::Result::Ok((offset, len, element_count))
1135 })();
1136 match offset_res {
1137 core::result::Result::Ok((offset, len, element_count)) => {
1138 if len > 0 {
1139 let end = offset.checked_add(len).ok_or(emboss_runtime::Error::OutOfBounds)?;
1140 self.storage.try_read_byte(end - 1)?;
1141 }
1142 let storage = self.storage.slice_mut(offset, len);
1143 core::result::Result::Ok(FirstKFrame_Payload_ArrayViewMut::new(storage, element_count))
1144 },
1145 core::result::Result::Err(e) => core::result::Result::Err(e),
1146 }
1147 }
1148
1149}
1150
1151impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for FirstKFrameMut<S> {
1152 type Writer = FirstKFrameWriter<S, emboss_runtime::UncheckedState>;
1153 fn into_writer(self) -> Self::Writer {
1154 FirstKFrameWriter::new(self.storage)
1155 }
1156}
1157
1158pub struct FirstKFrameWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
1159 storage: S,
1160 _marker: core::marker::PhantomData<ST>,
1161}
1162
1163impl<S: emboss_runtime::MutStorage> FirstKFrameWriter<S, emboss_runtime::UncheckedState> {
1164 pub fn new(storage: S) -> Self {
1165 Self {
1166 storage,
1167 _marker: core::marker::PhantomData,
1168 }
1169 }
1170}
1171
1172impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> FirstKFrameWriter<S, ST> {
1173 pub unsafe fn new_in_state(storage: S) -> Self {
1181 Self {
1182 storage,
1183 _marker: core::marker::PhantomData,
1184 }
1185 }
1186 pub fn into_storage(self) -> S {
1187 self.storage
1188 }
1189 pub fn into_view(self) -> FirstKFrame<S, ST> {
1191 unsafe { FirstKFrame::new_in_state(self.storage) }
1192 }
1193 pub fn as_view(&self) -> FirstKFrame<S::Sliced<'_>, ST> {
1195 unsafe { FirstKFrame::new_in_state(self.storage.slice(0, self.storage.len())) }
1196 }
1197 pub fn write_sdu_length(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> FirstKFrameWriter<S, ST::OnValidMutation> {
1198 let view = self.into_view();
1199 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
1200 let offset = (4) as usize;
1201 let len = (2) as usize;
1202 core::result::Result::Ok((offset, len))
1203 })().expect("valid layout in complete state");
1204 let mut storage = view.into_storage();
1205 {
1206 let slice = storage.slice_mut(offset, len);
1207 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
1208 field_view.try_write(val).expect("valid write in complete state");
1209 }
1210 unsafe { FirstKFrameWriter::new_in_state(storage) }
1211 }
1212
1213}
1214
1215impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for FirstKFrame<S, ST> {
1216 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
1217 let view = self;
1218 core::result::Result::Ok((core::cmp::max((core::cmp::max((core::cmp::max((0) as i64, (4) as i64)
1219) as i64, (6) as i64)
1220) as i64, ((if true { ( (6) as i64 + (({ let val = view.payload_size().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1221) as i64 )
1222 } else { 0 })
1223
1224) as i64)
1225) as usize)
1226 }
1227}
1228
1229impl<S: emboss_runtime::MutStorage> emboss_runtime::View for FirstKFrameMut<S> {
1230 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
1231 let view = self.as_view();
1232 <FirstKFrame<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
1233 }
1234}
1235
1236impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for FirstKFrameWriter<S, ST> {
1237 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
1238 let view = self.as_view();
1239 <FirstKFrame<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
1240 }
1241}
1242
1243impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for FirstKFrame<S, emboss_runtime::UncheckedState> {
1244 type Completed = FirstKFrame<S, emboss_runtime::CompleteState>;
1245 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
1246 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
1247 if self.storage.len() < required_size {
1248 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
1249 }
1250 core::result::Result::Ok(unsafe { FirstKFrame::new_in_state(self.storage) })
1251 }
1252}
1253
1254impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for FirstKFrameWriter<S, emboss_runtime::UncheckedState> {
1255 type Completed = FirstKFrameWriter<S, emboss_runtime::CompleteState>;
1256 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
1257 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
1258 if self.storage.len() < required_size {
1259 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
1260 }
1261 core::result::Result::Ok(unsafe { FirstKFrameWriter::new_in_state(self.storage) })
1262 }
1263}
1264
1265impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for FirstKFrame<S, emboss_runtime::UncheckedState> {
1266 type Ok = FirstKFrame<S, emboss_runtime::OkState>;
1267 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1268 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
1269 core::result::Result::Ok(unsafe { FirstKFrame::new_in_state(completed.into_storage()) })
1270 }
1271}
1272
1273impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for FirstKFrame<S, emboss_runtime::CompleteState> {
1274 type Ok = FirstKFrame<S, emboss_runtime::OkState>;
1275 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1276 core::result::Result::Ok(unsafe { FirstKFrame::new_in_state(self.into_storage()) })
1277 }
1278}
1279
1280impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for FirstKFrame<S, emboss_runtime::OkState> {
1281 type Ok = FirstKFrame<S, emboss_runtime::OkState>;
1282 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1283 core::result::Result::Ok(self)
1284 }
1285}
1286
1287impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for FirstKFrameWriter<S, emboss_runtime::UncheckedState> {
1288 type Ok = FirstKFrameWriter<S, emboss_runtime::OkState>;
1289 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1290 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
1291 core::result::Result::Ok(unsafe { FirstKFrameWriter::new_in_state(completed.into_storage()) })
1292 }
1293}
1294
1295impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for FirstKFrameWriter<S, emboss_runtime::CompleteState> {
1296 type Ok = FirstKFrameWriter<S, emboss_runtime::OkState>;
1297 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1298 core::result::Result::Ok(unsafe { FirstKFrameWriter::new_in_state(self.into_storage()) })
1299 }
1300}
1301
1302impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for FirstKFrameWriter<S, emboss_runtime::OkState> {
1303 type Ok = FirstKFrameWriter<S, emboss_runtime::OkState>;
1304 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1305 core::result::Result::Ok(self)
1306 }
1307}
1308
1309pub mod first_k_frame {
1310 pub type View<S, ST = emboss_runtime::UncheckedState> = super::FirstKFrame<S, ST>;
1311 pub type ViewMut<S> = super::FirstKFrameMut<S>;
1312 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::FirstKFrameWriter<S, ST>;
1313
1314 pub const MIN_SIZE_IN_BYTES: usize = 6;
1315 pub const MAX_SIZE_IN_BYTES: usize = 65539;
1316}pub struct SubsequentKFrame_Payload_ArrayView<S: emboss_runtime::Storage> {
1317 storage: S,
1318 element_count: usize,
1319}
1320
1321impl<S: emboss_runtime::Storage + core::clone::Clone> core::clone::Clone for SubsequentKFrame_Payload_ArrayView<S> {
1322 fn clone(&self) -> Self {
1323 Self {
1324 storage: self.storage.clone(),
1325 element_count: self.element_count,
1326 }
1327 }
1328}
1329
1330impl<S: emboss_runtime::Storage> SubsequentKFrame_Payload_ArrayView<S> {
1331 pub const ELEMENT_SIZE_BYTES: usize = 1;
1332 pub fn new(storage: S, element_count: usize) -> Self {
1333 Self { storage, element_count }
1334 }
1335 pub fn element_count(&self) -> usize {
1336 self.element_count
1337 }
1338 pub fn get(&self, index: usize) -> core::result::Result<emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::Sliced<'_>>
1339, emboss_runtime::Error> {
1340 if index >= self.element_count {
1341 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
1342 }
1343 let offset = index * Self::ELEMENT_SIZE_BYTES;
1344 let storage = self.storage.slice(offset, Self::ELEMENT_SIZE_BYTES);
1345 core::result::Result::Ok(emboss_runtime::UInt::new(storage)
1346)
1347 }
1348}
1349
1350pub struct SubsequentKFrame_Payload_ArrayViewMut<S: emboss_runtime::MutStorage> {
1351 storage: S,
1352 element_count: usize,
1353}
1354
1355impl<S: emboss_runtime::MutStorage> SubsequentKFrame_Payload_ArrayViewMut<S> {
1356 pub const ELEMENT_SIZE_BYTES: usize = 1;
1357 pub fn new(storage: S, element_count: usize) -> Self {
1358 Self { storage, element_count }
1359 }
1360 pub fn element_count(&self) -> usize {
1361 self.element_count
1362 }
1363 pub fn get_mut(&mut self, index: usize) -> core::result::Result<emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::SlicedMut<'_>>
1364, emboss_runtime::Error> {
1365 if index >= self.element_count {
1366 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
1367 }
1368 let offset = index * Self::ELEMENT_SIZE_BYTES;
1369 let storage = self.storage.slice_mut(offset, Self::ELEMENT_SIZE_BYTES);
1370 core::result::Result::Ok(emboss_runtime::UInt::new(storage)
1371)
1372 }
1373}
1374pub struct SubsequentKFrame<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
1375 storage: S,
1376 _marker: core::marker::PhantomData<ST>,
1377}
1378
1379impl<S: emboss_runtime::Storage> SubsequentKFrame<S, emboss_runtime::UncheckedState> {
1380 pub fn new(storage: S) -> Self {
1381 Self {
1382 storage,
1383 _marker: core::marker::PhantomData,
1384 }
1385 }
1386}
1387
1388impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for SubsequentKFrame<S, ST> {
1389 fn clone(&self) -> Self {
1390 Self {
1391 storage: self.storage.clone(),
1392 _marker: core::marker::PhantomData,
1393 }
1394 }
1395}
1396
1397impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> SubsequentKFrame<S, ST> {
1398 pub unsafe fn new_in_state(storage: S) -> Self {
1406 Self {
1407 storage,
1408 _marker: core::marker::PhantomData,
1409 }
1410 }
1411 pub fn into_storage(self) -> S {
1412 self.storage
1413 }
1414 pub fn header(&self) -> BasicL2capHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
1415 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
1416 let offset = (0) as usize;
1417 let len = (4) as usize;
1418 core::result::Result::Ok((offset, len))
1419 })().unwrap_or((usize::MAX, 0));
1420 let storage = self.storage.slice(offset, len);
1421 unsafe { BasicL2capHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
1422 }
1423 pub fn pdu_length(&self) -> emboss_runtime::VirtualField<u64> {
1424 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
1425 core::result::Result::Ok( (({ let val = self.header().pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1426) as u64 )
1427 })();
1428 emboss_runtime::VirtualField::new(value)
1429 }
1430 pub fn channel_id(&self) -> emboss_runtime::VirtualField<u64> {
1431 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
1432 core::result::Result::Ok( (({ let val = self.header().channel_id().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1433) as u64 )
1434 })();
1435 emboss_runtime::VirtualField::new(value)
1436 }
1437 pub fn payload_size(&self) -> emboss_runtime::VirtualField<u64> {
1438 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
1439 core::result::Result::Ok( (({ let val = self.pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1440) as u64 )
1441 })();
1442 emboss_runtime::VirtualField::new(value)
1443 }
1444 pub fn payload(&self) -> core::result::Result<SubsequentKFrame_Payload_ArrayView<S::Sliced<'_>>, emboss_runtime::Error> {
1445 let offset_res = (|| -> core::result::Result<(usize, usize, usize), emboss_runtime::Error> {
1446 let offset = (4) as usize;
1447 let len = (({ let val = self.payload_size().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1448) as usize;
1449 let element_count = (len / (1)) as usize;
1450 core::result::Result::Ok((offset, len, element_count))
1451 })();
1452 match offset_res {
1453 core::result::Result::Ok((offset, len, element_count)) => {
1454 if len > 0 {
1455 let end = offset.checked_add(len).ok_or(emboss_runtime::Error::OutOfBounds)?;
1456 self.storage.try_read_byte(end - 1)?;
1457 }
1458 let storage = self.storage.slice(offset, len);
1459 core::result::Result::Ok(SubsequentKFrame_Payload_ArrayView::new(storage, element_count))
1460 },
1461 core::result::Result::Err(e) => core::result::Result::Err(e),
1462 }
1463 }
1464
1465}
1466
1467pub struct SubsequentKFrameMut<S: emboss_runtime::MutStorage> {
1468 storage: S,
1469}
1470
1471impl<S: emboss_runtime::MutStorage> SubsequentKFrameMut<S> {
1472 pub fn new(storage: S) -> Self {
1473 Self {
1474 storage,
1475 }
1476 }
1477 pub fn into_writer(self) -> SubsequentKFrameWriter<S, emboss_runtime::UncheckedState> {
1478 SubsequentKFrameWriter::new(self.storage)
1479 }
1480 pub fn as_view(&self) -> SubsequentKFrame<S::Sliced<'_>, emboss_runtime::UncheckedState> {
1482 unsafe { SubsequentKFrame::new_in_state(self.storage.slice(0, self.storage.len())) }
1483 }
1484 pub fn header(&mut self) -> BasicL2capHeaderMut<S::SlicedMut<'_>> {
1485 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
1486 let offset = (0) as usize;
1487 let len = (4) as usize;
1488 core::result::Result::Ok((offset, len))
1489 })().unwrap_or((usize::MAX, 0));
1490 let storage = self.storage.slice_mut(offset, len);
1491 BasicL2capHeaderMut::<S::SlicedMut<'_>>::new(storage)
1492 }
1493 pub fn pdu_length(&mut self) -> emboss_runtime::VirtualField<u64> {
1494 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
1495 core::result::Result::Ok( (({ let val = self.header().pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1496) as u64 )
1497 })();
1498 emboss_runtime::VirtualField::new(value)
1499 }
1500 pub fn channel_id(&mut self) -> emboss_runtime::VirtualField<u64> {
1501 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
1502 core::result::Result::Ok( (({ let val = self.header().channel_id().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1503) as u64 )
1504 })();
1505 emboss_runtime::VirtualField::new(value)
1506 }
1507 pub fn payload_size(&mut self) -> emboss_runtime::VirtualField<u64> {
1508 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
1509 core::result::Result::Ok( (({ let val = self.pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1510) as u64 )
1511 })();
1512 emboss_runtime::VirtualField::new(value)
1513 }
1514 pub fn payload_mut(&mut self) -> core::result::Result<SubsequentKFrame_Payload_ArrayViewMut<S::SlicedMut<'_>>, emboss_runtime::Error> {
1515 let offset_res = (|| -> core::result::Result<(usize, usize, usize), emboss_runtime::Error> {
1516 let offset = (4) as usize;
1517 let len = (({ let val = self.payload_size().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1518) as usize;
1519 let element_count = (len / (1)) as usize;
1520 core::result::Result::Ok((offset, len, element_count))
1521 })();
1522 match offset_res {
1523 core::result::Result::Ok((offset, len, element_count)) => {
1524 if len > 0 {
1525 let end = offset.checked_add(len).ok_or(emboss_runtime::Error::OutOfBounds)?;
1526 self.storage.try_read_byte(end - 1)?;
1527 }
1528 let storage = self.storage.slice_mut(offset, len);
1529 core::result::Result::Ok(SubsequentKFrame_Payload_ArrayViewMut::new(storage, element_count))
1530 },
1531 core::result::Result::Err(e) => core::result::Result::Err(e),
1532 }
1533 }
1534
1535}
1536
1537impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for SubsequentKFrameMut<S> {
1538 type Writer = SubsequentKFrameWriter<S, emboss_runtime::UncheckedState>;
1539 fn into_writer(self) -> Self::Writer {
1540 SubsequentKFrameWriter::new(self.storage)
1541 }
1542}
1543
1544pub struct SubsequentKFrameWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
1545 storage: S,
1546 _marker: core::marker::PhantomData<ST>,
1547}
1548
1549impl<S: emboss_runtime::MutStorage> SubsequentKFrameWriter<S, emboss_runtime::UncheckedState> {
1550 pub fn new(storage: S) -> Self {
1551 Self {
1552 storage,
1553 _marker: core::marker::PhantomData,
1554 }
1555 }
1556}
1557
1558impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> SubsequentKFrameWriter<S, ST> {
1559 pub unsafe fn new_in_state(storage: S) -> Self {
1567 Self {
1568 storage,
1569 _marker: core::marker::PhantomData,
1570 }
1571 }
1572 pub fn into_storage(self) -> S {
1573 self.storage
1574 }
1575 pub fn into_view(self) -> SubsequentKFrame<S, ST> {
1577 unsafe { SubsequentKFrame::new_in_state(self.storage) }
1578 }
1579 pub fn as_view(&self) -> SubsequentKFrame<S::Sliced<'_>, ST> {
1581 unsafe { SubsequentKFrame::new_in_state(self.storage.slice(0, self.storage.len())) }
1582 }
1583
1584}
1585
1586impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for SubsequentKFrame<S, ST> {
1587 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
1588 let view = self;
1589 core::result::Result::Ok((core::cmp::max((core::cmp::max((0) as i64, (4) as i64)
1590) as i64, ((if true { ( (4) as i64 + (({ let val = view.payload_size().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
1591) as i64 )
1592 } else { 0 })
1593
1594) as i64)
1595) as usize)
1596 }
1597}
1598
1599impl<S: emboss_runtime::MutStorage> emboss_runtime::View for SubsequentKFrameMut<S> {
1600 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
1601 let view = self.as_view();
1602 <SubsequentKFrame<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
1603 }
1604}
1605
1606impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for SubsequentKFrameWriter<S, ST> {
1607 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
1608 let view = self.as_view();
1609 <SubsequentKFrame<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
1610 }
1611}
1612
1613impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for SubsequentKFrame<S, emboss_runtime::UncheckedState> {
1614 type Completed = SubsequentKFrame<S, emboss_runtime::CompleteState>;
1615 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
1616 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
1617 if self.storage.len() < required_size {
1618 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
1619 }
1620 core::result::Result::Ok(unsafe { SubsequentKFrame::new_in_state(self.storage) })
1621 }
1622}
1623
1624impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for SubsequentKFrameWriter<S, emboss_runtime::UncheckedState> {
1625 type Completed = SubsequentKFrameWriter<S, emboss_runtime::CompleteState>;
1626 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
1627 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
1628 if self.storage.len() < required_size {
1629 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
1630 }
1631 core::result::Result::Ok(unsafe { SubsequentKFrameWriter::new_in_state(self.storage) })
1632 }
1633}
1634
1635impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for SubsequentKFrame<S, emboss_runtime::UncheckedState> {
1636 type Ok = SubsequentKFrame<S, emboss_runtime::OkState>;
1637 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1638 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
1639 core::result::Result::Ok(unsafe { SubsequentKFrame::new_in_state(completed.into_storage()) })
1640 }
1641}
1642
1643impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for SubsequentKFrame<S, emboss_runtime::CompleteState> {
1644 type Ok = SubsequentKFrame<S, emboss_runtime::OkState>;
1645 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1646 core::result::Result::Ok(unsafe { SubsequentKFrame::new_in_state(self.into_storage()) })
1647 }
1648}
1649
1650impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for SubsequentKFrame<S, emboss_runtime::OkState> {
1651 type Ok = SubsequentKFrame<S, emboss_runtime::OkState>;
1652 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1653 core::result::Result::Ok(self)
1654 }
1655}
1656
1657impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for SubsequentKFrameWriter<S, emboss_runtime::UncheckedState> {
1658 type Ok = SubsequentKFrameWriter<S, emboss_runtime::OkState>;
1659 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1660 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
1661 core::result::Result::Ok(unsafe { SubsequentKFrameWriter::new_in_state(completed.into_storage()) })
1662 }
1663}
1664
1665impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for SubsequentKFrameWriter<S, emboss_runtime::CompleteState> {
1666 type Ok = SubsequentKFrameWriter<S, emboss_runtime::OkState>;
1667 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1668 core::result::Result::Ok(unsafe { SubsequentKFrameWriter::new_in_state(self.into_storage()) })
1669 }
1670}
1671
1672impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for SubsequentKFrameWriter<S, emboss_runtime::OkState> {
1673 type Ok = SubsequentKFrameWriter<S, emboss_runtime::OkState>;
1674 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1675 core::result::Result::Ok(self)
1676 }
1677}
1678
1679pub mod subsequent_k_frame {
1680 pub type View<S, ST = emboss_runtime::UncheckedState> = super::SubsequentKFrame<S, ST>;
1681 pub type ViewMut<S> = super::SubsequentKFrameMut<S>;
1682 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::SubsequentKFrameWriter<S, ST>;
1683
1684 pub const MIN_SIZE_IN_BYTES: usize = 4;
1685 pub const MAX_SIZE_IN_BYTES: usize = 65539;
1686}pub struct KFrameSduHeader<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
1687 storage: S,
1688 _marker: core::marker::PhantomData<ST>,
1689}
1690
1691impl<S: emboss_runtime::Storage> KFrameSduHeader<S, emboss_runtime::UncheckedState> {
1692 pub fn new(storage: S) -> Self {
1693 Self {
1694 storage,
1695 _marker: core::marker::PhantomData,
1696 }
1697 }
1698}
1699
1700impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for KFrameSduHeader<S, ST> {
1701 fn clone(&self) -> Self {
1702 Self {
1703 storage: self.storage.clone(),
1704 _marker: core::marker::PhantomData,
1705 }
1706 }
1707}
1708
1709impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> KFrameSduHeader<S, ST> {
1710 pub unsafe fn new_in_state(storage: S) -> Self {
1718 Self {
1719 storage,
1720 _marker: core::marker::PhantomData,
1721 }
1722 }
1723 pub fn into_storage(self) -> S {
1724 self.storage
1725 }
1726 pub fn sdu_length(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
1727 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
1728 let offset = (0) as usize;
1729 let len = (2) as usize;
1730 core::result::Result::Ok((offset, len))
1731 })().unwrap_or((usize::MAX, 0));
1732 let storage = self.storage.slice(offset, len);
1733 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
1734 }
1735
1736}
1737
1738pub struct KFrameSduHeaderMut<S: emboss_runtime::MutStorage> {
1739 storage: S,
1740}
1741
1742impl<S: emboss_runtime::MutStorage> KFrameSduHeaderMut<S> {
1743 pub fn new(storage: S) -> Self {
1744 Self {
1745 storage,
1746 }
1747 }
1748 pub fn into_writer(self) -> KFrameSduHeaderWriter<S, emboss_runtime::UncheckedState> {
1749 KFrameSduHeaderWriter::new(self.storage)
1750 }
1751 pub fn as_view(&self) -> KFrameSduHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
1753 unsafe { KFrameSduHeader::new_in_state(self.storage.slice(0, self.storage.len())) }
1754 }
1755 pub fn sdu_length(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
1756 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
1757 let offset = (0) as usize;
1758 let len = (2) as usize;
1759 core::result::Result::Ok((offset, len))
1760 })().unwrap_or((usize::MAX, 0));
1761 let storage = self.storage.slice_mut(offset, len);
1762 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
1763 }
1764
1765}
1766
1767impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for KFrameSduHeaderMut<S> {
1768 type Writer = KFrameSduHeaderWriter<S, emboss_runtime::UncheckedState>;
1769 fn into_writer(self) -> Self::Writer {
1770 KFrameSduHeaderWriter::new(self.storage)
1771 }
1772}
1773
1774pub struct KFrameSduHeaderWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
1775 storage: S,
1776 _marker: core::marker::PhantomData<ST>,
1777}
1778
1779impl<S: emboss_runtime::MutStorage> KFrameSduHeaderWriter<S, emboss_runtime::UncheckedState> {
1780 pub fn new(storage: S) -> Self {
1781 Self {
1782 storage,
1783 _marker: core::marker::PhantomData,
1784 }
1785 }
1786}
1787
1788impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> KFrameSduHeaderWriter<S, ST> {
1789 pub unsafe fn new_in_state(storage: S) -> Self {
1797 Self {
1798 storage,
1799 _marker: core::marker::PhantomData,
1800 }
1801 }
1802 pub fn into_storage(self) -> S {
1803 self.storage
1804 }
1805 pub fn into_view(self) -> KFrameSduHeader<S, ST> {
1807 unsafe { KFrameSduHeader::new_in_state(self.storage) }
1808 }
1809 pub fn as_view(&self) -> KFrameSduHeader<S::Sliced<'_>, ST> {
1811 unsafe { KFrameSduHeader::new_in_state(self.storage.slice(0, self.storage.len())) }
1812 }
1813 pub fn write_sdu_length(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> KFrameSduHeaderWriter<S, ST::OnValidMutation> {
1814 let view = self.into_view();
1815 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
1816 let offset = (0) as usize;
1817 let len = (2) as usize;
1818 core::result::Result::Ok((offset, len))
1819 })().expect("valid layout in complete state");
1820 let mut storage = view.into_storage();
1821 {
1822 let slice = storage.slice_mut(offset, len);
1823 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
1824 field_view.try_write(val).expect("valid write in complete state");
1825 }
1826 unsafe { KFrameSduHeaderWriter::new_in_state(storage) }
1827 }
1828
1829}
1830
1831impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for KFrameSduHeader<S, ST> {
1832 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
1833 let view = self;
1834 core::result::Result::Ok((2) as usize)
1835 }
1836}
1837
1838impl<S: emboss_runtime::MutStorage> emboss_runtime::View for KFrameSduHeaderMut<S> {
1839 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
1840 let view = self.as_view();
1841 <KFrameSduHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
1842 }
1843}
1844
1845impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for KFrameSduHeaderWriter<S, ST> {
1846 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
1847 let view = self.as_view();
1848 <KFrameSduHeader<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
1849 }
1850}
1851
1852impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for KFrameSduHeader<S, emboss_runtime::UncheckedState> {
1853 type Completed = KFrameSduHeader<S, emboss_runtime::CompleteState>;
1854 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
1855 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
1856 if self.storage.len() < required_size {
1857 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
1858 }
1859 core::result::Result::Ok(unsafe { KFrameSduHeader::new_in_state(self.storage) })
1860 }
1861}
1862
1863impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for KFrameSduHeaderWriter<S, emboss_runtime::UncheckedState> {
1864 type Completed = KFrameSduHeaderWriter<S, emboss_runtime::CompleteState>;
1865 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
1866 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
1867 if self.storage.len() < required_size {
1868 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
1869 }
1870 core::result::Result::Ok(unsafe { KFrameSduHeaderWriter::new_in_state(self.storage) })
1871 }
1872}
1873
1874impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for KFrameSduHeader<S, emboss_runtime::UncheckedState> {
1875 type Ok = KFrameSduHeader<S, emboss_runtime::OkState>;
1876 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1877 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
1878 core::result::Result::Ok(unsafe { KFrameSduHeader::new_in_state(completed.into_storage()) })
1879 }
1880}
1881
1882impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for KFrameSduHeader<S, emboss_runtime::CompleteState> {
1883 type Ok = KFrameSduHeader<S, emboss_runtime::OkState>;
1884 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1885 core::result::Result::Ok(unsafe { KFrameSduHeader::new_in_state(self.into_storage()) })
1886 }
1887}
1888
1889impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for KFrameSduHeader<S, emboss_runtime::OkState> {
1890 type Ok = KFrameSduHeader<S, emboss_runtime::OkState>;
1891 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1892 core::result::Result::Ok(self)
1893 }
1894}
1895
1896impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for KFrameSduHeaderWriter<S, emboss_runtime::UncheckedState> {
1897 type Ok = KFrameSduHeaderWriter<S, emboss_runtime::OkState>;
1898 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1899 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
1900 core::result::Result::Ok(unsafe { KFrameSduHeaderWriter::new_in_state(completed.into_storage()) })
1901 }
1902}
1903
1904impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for KFrameSduHeaderWriter<S, emboss_runtime::CompleteState> {
1905 type Ok = KFrameSduHeaderWriter<S, emboss_runtime::OkState>;
1906 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1907 core::result::Result::Ok(unsafe { KFrameSduHeaderWriter::new_in_state(self.into_storage()) })
1908 }
1909}
1910
1911impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for KFrameSduHeaderWriter<S, emboss_runtime::OkState> {
1912 type Ok = KFrameSduHeaderWriter<S, emboss_runtime::OkState>;
1913 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
1914 core::result::Result::Ok(self)
1915 }
1916}
1917
1918pub mod k_frame_sdu_header {
1919 pub type View<S, ST = emboss_runtime::UncheckedState> = super::KFrameSduHeader<S, ST>;
1920 pub type ViewMut<S> = super::KFrameSduHeaderMut<S>;
1921 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::KFrameSduHeaderWriter<S, ST>;
1922
1923 pub const MIN_SIZE_IN_BYTES: usize = 2;
1924 pub const MAX_SIZE_IN_BYTES: usize = 2;
1925 pub const SIZE_IN_BYTES: usize = 2;
1926}pub struct KFramePduHeader<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
1927 storage: S,
1928 _marker: core::marker::PhantomData<ST>,
1929}
1930
1931impl<S: emboss_runtime::Storage> KFramePduHeader<S, emboss_runtime::UncheckedState> {
1932 pub fn new(storage: S) -> Self {
1933 Self {
1934 storage,
1935 _marker: core::marker::PhantomData,
1936 }
1937 }
1938}
1939
1940impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for KFramePduHeader<S, ST> {
1941 fn clone(&self) -> Self {
1942 Self {
1943 storage: self.storage.clone(),
1944 _marker: core::marker::PhantomData,
1945 }
1946 }
1947}
1948
1949impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> KFramePduHeader<S, ST> {
1950 pub unsafe fn new_in_state(storage: S) -> Self {
1958 Self {
1959 storage,
1960 _marker: core::marker::PhantomData,
1961 }
1962 }
1963 pub fn into_storage(self) -> S {
1964 self.storage
1965 }
1966 pub fn pdu_length(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
1967 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
1968 let offset = (0) as usize;
1969 let len = (2) as usize;
1970 core::result::Result::Ok((offset, len))
1971 })().unwrap_or((usize::MAX, 0));
1972 let storage = self.storage.slice(offset, len);
1973 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
1974 }
1975 pub fn channel_id(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
1976 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
1977 let offset = (2) as usize;
1978 let len = (2) as usize;
1979 core::result::Result::Ok((offset, len))
1980 })().unwrap_or((usize::MAX, 0));
1981 let storage = self.storage.slice(offset, len);
1982 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
1983 }
1984
1985}
1986
1987pub struct KFramePduHeaderMut<S: emboss_runtime::MutStorage> {
1988 storage: S,
1989}
1990
1991impl<S: emboss_runtime::MutStorage> KFramePduHeaderMut<S> {
1992 pub fn new(storage: S) -> Self {
1993 Self {
1994 storage,
1995 }
1996 }
1997 pub fn into_writer(self) -> KFramePduHeaderWriter<S, emboss_runtime::UncheckedState> {
1998 KFramePduHeaderWriter::new(self.storage)
1999 }
2000 pub fn as_view(&self) -> KFramePduHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
2002 unsafe { KFramePduHeader::new_in_state(self.storage.slice(0, self.storage.len())) }
2003 }
2004 pub fn pdu_length(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
2005 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
2006 let offset = (0) as usize;
2007 let len = (2) as usize;
2008 core::result::Result::Ok((offset, len))
2009 })().unwrap_or((usize::MAX, 0));
2010 let storage = self.storage.slice_mut(offset, len);
2011 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
2012 }
2013 pub fn channel_id(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
2014 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
2015 let offset = (2) as usize;
2016 let len = (2) as usize;
2017 core::result::Result::Ok((offset, len))
2018 })().unwrap_or((usize::MAX, 0));
2019 let storage = self.storage.slice_mut(offset, len);
2020 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
2021 }
2022
2023}
2024
2025impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for KFramePduHeaderMut<S> {
2026 type Writer = KFramePduHeaderWriter<S, emboss_runtime::UncheckedState>;
2027 fn into_writer(self) -> Self::Writer {
2028 KFramePduHeaderWriter::new(self.storage)
2029 }
2030}
2031
2032pub struct KFramePduHeaderWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
2033 storage: S,
2034 _marker: core::marker::PhantomData<ST>,
2035}
2036
2037impl<S: emboss_runtime::MutStorage> KFramePduHeaderWriter<S, emboss_runtime::UncheckedState> {
2038 pub fn new(storage: S) -> Self {
2039 Self {
2040 storage,
2041 _marker: core::marker::PhantomData,
2042 }
2043 }
2044}
2045
2046impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> KFramePduHeaderWriter<S, ST> {
2047 pub unsafe fn new_in_state(storage: S) -> Self {
2055 Self {
2056 storage,
2057 _marker: core::marker::PhantomData,
2058 }
2059 }
2060 pub fn into_storage(self) -> S {
2061 self.storage
2062 }
2063 pub fn into_view(self) -> KFramePduHeader<S, ST> {
2065 unsafe { KFramePduHeader::new_in_state(self.storage) }
2066 }
2067 pub fn as_view(&self) -> KFramePduHeader<S::Sliced<'_>, ST> {
2069 unsafe { KFramePduHeader::new_in_state(self.storage.slice(0, self.storage.len())) }
2070 }
2071 pub fn write_pdu_length(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> KFramePduHeaderWriter<S, ST::OnValidMutation> {
2072 let view = self.into_view();
2073 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
2074 let offset = (0) as usize;
2075 let len = (2) as usize;
2076 core::result::Result::Ok((offset, len))
2077 })().expect("valid layout in complete state");
2078 let mut storage = view.into_storage();
2079 {
2080 let slice = storage.slice_mut(offset, len);
2081 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
2082 field_view.try_write(val).expect("valid write in complete state");
2083 }
2084 unsafe { KFramePduHeaderWriter::new_in_state(storage) }
2085 }
2086 pub fn write_channel_id(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> KFramePduHeaderWriter<S, ST::OnValidMutation> {
2087 let view = self.into_view();
2088 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
2089 let offset = (2) as usize;
2090 let len = (2) as usize;
2091 core::result::Result::Ok((offset, len))
2092 })().expect("valid layout in complete state");
2093 let mut storage = view.into_storage();
2094 {
2095 let slice = storage.slice_mut(offset, len);
2096 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
2097 field_view.try_write(val).expect("valid write in complete state");
2098 }
2099 unsafe { KFramePduHeaderWriter::new_in_state(storage) }
2100 }
2101
2102}
2103
2104impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for KFramePduHeader<S, ST> {
2105 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
2106 let view = self;
2107 core::result::Result::Ok((4) as usize)
2108 }
2109}
2110
2111impl<S: emboss_runtime::MutStorage> emboss_runtime::View for KFramePduHeaderMut<S> {
2112 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
2113 let view = self.as_view();
2114 <KFramePduHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
2115 }
2116}
2117
2118impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for KFramePduHeaderWriter<S, ST> {
2119 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
2120 let view = self.as_view();
2121 <KFramePduHeader<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
2122 }
2123}
2124
2125impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for KFramePduHeader<S, emboss_runtime::UncheckedState> {
2126 type Completed = KFramePduHeader<S, emboss_runtime::CompleteState>;
2127 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
2128 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
2129 if self.storage.len() < required_size {
2130 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
2131 }
2132 core::result::Result::Ok(unsafe { KFramePduHeader::new_in_state(self.storage) })
2133 }
2134}
2135
2136impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for KFramePduHeaderWriter<S, emboss_runtime::UncheckedState> {
2137 type Completed = KFramePduHeaderWriter<S, emboss_runtime::CompleteState>;
2138 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
2139 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
2140 if self.storage.len() < required_size {
2141 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
2142 }
2143 core::result::Result::Ok(unsafe { KFramePduHeaderWriter::new_in_state(self.storage) })
2144 }
2145}
2146
2147impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for KFramePduHeader<S, emboss_runtime::UncheckedState> {
2148 type Ok = KFramePduHeader<S, emboss_runtime::OkState>;
2149 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
2150 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
2151 core::result::Result::Ok(unsafe { KFramePduHeader::new_in_state(completed.into_storage()) })
2152 }
2153}
2154
2155impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for KFramePduHeader<S, emboss_runtime::CompleteState> {
2156 type Ok = KFramePduHeader<S, emboss_runtime::OkState>;
2157 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
2158 core::result::Result::Ok(unsafe { KFramePduHeader::new_in_state(self.into_storage()) })
2159 }
2160}
2161
2162impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for KFramePduHeader<S, emboss_runtime::OkState> {
2163 type Ok = KFramePduHeader<S, emboss_runtime::OkState>;
2164 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
2165 core::result::Result::Ok(self)
2166 }
2167}
2168
2169impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for KFramePduHeaderWriter<S, emboss_runtime::UncheckedState> {
2170 type Ok = KFramePduHeaderWriter<S, emboss_runtime::OkState>;
2171 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
2172 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
2173 core::result::Result::Ok(unsafe { KFramePduHeaderWriter::new_in_state(completed.into_storage()) })
2174 }
2175}
2176
2177impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for KFramePduHeaderWriter<S, emboss_runtime::CompleteState> {
2178 type Ok = KFramePduHeaderWriter<S, emboss_runtime::OkState>;
2179 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
2180 core::result::Result::Ok(unsafe { KFramePduHeaderWriter::new_in_state(self.into_storage()) })
2181 }
2182}
2183
2184impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for KFramePduHeaderWriter<S, emboss_runtime::OkState> {
2185 type Ok = KFramePduHeaderWriter<S, emboss_runtime::OkState>;
2186 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
2187 core::result::Result::Ok(self)
2188 }
2189}
2190
2191pub mod k_frame_pdu_header {
2192 pub type View<S, ST = emboss_runtime::UncheckedState> = super::KFramePduHeader<S, ST>;
2193 pub type ViewMut<S> = super::KFramePduHeaderMut<S>;
2194 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::KFramePduHeaderWriter<S, ST>;
2195
2196 pub const MIN_SIZE_IN_BYTES: usize = 4;
2197 pub const MAX_SIZE_IN_BYTES: usize = 4;
2198 pub const SIZE_IN_BYTES: usize = 4;
2199}#[derive(Copy, Clone, Debug, Eq, PartialEq)]
2200#[repr(u64)]
2201pub enum L2capSignalingPacketCode {
2202 COMMAND_REJECT_RSP = 1,
2203 CONNECTION_REQ = 2,
2204 CONNECTION_RSP = 3,
2205 CONFIGURATION_REQ = 4,
2206 CONFIGURATION_RSP = 5,
2207 DISCONNECTION_REQ = 6,
2208 DISCONNECTION_RSP = 7,
2209 ECHO_REQ = 8,
2210 ECHO_RSP = 9,
2211 INFORMATION_REQ = 10,
2212 INFORMATION_RSP = 11,
2213 CONNECTION_PARAMETER_UPDATE_REQ = 18,
2214 CONNECTION_PARAMETER_UPDATE_RSP = 19,
2215 LE_CREDIT_BASED_CONNECTION_REQ = 20,
2216 LE_CREDIT_BASED_CONNECTION_RSP = 21,
2217 FLOW_CONTROL_CREDIT_IND = 22,
2218 CREDIT_BASED_CONNECTION_REQ = 23,
2219 CREDIT_BASED_CONNECTION_RSP = 24,
2220 CREDIT_BASED_RECONFIGURE_REQ = 25,
2221 CREDIT_BASED_RECONFIGURE_RSP = 26,
2222
2223}
2224
2225impl core::convert::From<L2capSignalingPacketCode> for u8 { fn from(val: L2capSignalingPacketCode) -> Self { val as u8 } }
2226impl core::convert::From<L2capSignalingPacketCode> for u16 { fn from(val: L2capSignalingPacketCode) -> Self { val as u16 } }
2227impl core::convert::From<L2capSignalingPacketCode> for u32 { fn from(val: L2capSignalingPacketCode) -> Self { val as u32 } }
2228impl core::convert::From<L2capSignalingPacketCode> for u64 { fn from(val: L2capSignalingPacketCode) -> Self { val as u64 } }
2229impl core::convert::From<L2capSignalingPacketCode> for i8 { fn from(val: L2capSignalingPacketCode) -> Self { val as i8 } }
2230impl core::convert::From<L2capSignalingPacketCode> for i16 { fn from(val: L2capSignalingPacketCode) -> Self { val as i16 } }
2231impl core::convert::From<L2capSignalingPacketCode> for i32 { fn from(val: L2capSignalingPacketCode) -> Self { val as i32 } }
2232impl core::convert::From<L2capSignalingPacketCode> for i64 { fn from(val: L2capSignalingPacketCode) -> Self { val as i64 } }
2233
2234impl emboss_runtime::SafeCmp<L2capSignalingPacketCode> for L2capSignalingPacketCode {
2235 fn safe_eq(&self, other: Self) -> bool { *self == other }
2236 fn safe_less(&self, other: Self) -> bool { (*self as u64) < (other as u64) }
2237}
2238
2239impl emboss_runtime::SafeCmp<u64> for L2capSignalingPacketCode {
2240 fn safe_eq(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
2241 fn safe_less(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
2242}
2243
2244impl emboss_runtime::SafeCmp<i64> for L2capSignalingPacketCode {
2245 fn safe_eq(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
2246 fn safe_less(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
2247}
2248
2249impl emboss_runtime::SafeCmp<i32> for L2capSignalingPacketCode {
2250 fn safe_eq(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as i64) }
2251 fn safe_less(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as i64) }
2252}
2253
2254impl emboss_runtime::SafeCmp<u32> for L2capSignalingPacketCode {
2255 fn safe_eq(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as u64) }
2256 fn safe_less(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as u64) }
2257}
2258
2259impl emboss_runtime::SafeCmp<L2capSignalingPacketCode> for u64 {
2260 fn safe_eq(&self, other: L2capSignalingPacketCode) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
2261 fn safe_less(&self, other: L2capSignalingPacketCode) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
2262}
2263
2264impl emboss_runtime::SafeCmp<L2capSignalingPacketCode> for i64 {
2265 fn safe_eq(&self, other: L2capSignalingPacketCode) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
2266 fn safe_less(&self, other: L2capSignalingPacketCode) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
2267}
2268
2269impl<V: core::convert::Into<u64> + core::marker::Copy> emboss_runtime::TryFromRaw<V> for L2capSignalingPacketCode {
2270 fn try_from_raw(val: V) -> core::result::Result<Self, emboss_runtime::Error<V>> {
2271 let v_raw: u64 = val.into();
2272 match v_raw {
2273 1 => Ok(L2capSignalingPacketCode::COMMAND_REJECT_RSP),
2274 2 => Ok(L2capSignalingPacketCode::CONNECTION_REQ),
2275 3 => Ok(L2capSignalingPacketCode::CONNECTION_RSP),
2276 4 => Ok(L2capSignalingPacketCode::CONFIGURATION_REQ),
2277 5 => Ok(L2capSignalingPacketCode::CONFIGURATION_RSP),
2278 6 => Ok(L2capSignalingPacketCode::DISCONNECTION_REQ),
2279 7 => Ok(L2capSignalingPacketCode::DISCONNECTION_RSP),
2280 8 => Ok(L2capSignalingPacketCode::ECHO_REQ),
2281 9 => Ok(L2capSignalingPacketCode::ECHO_RSP),
2282 10 => Ok(L2capSignalingPacketCode::INFORMATION_REQ),
2283 11 => Ok(L2capSignalingPacketCode::INFORMATION_RSP),
2284 18 => Ok(L2capSignalingPacketCode::CONNECTION_PARAMETER_UPDATE_REQ),
2285 19 => Ok(L2capSignalingPacketCode::CONNECTION_PARAMETER_UPDATE_RSP),
2286 20 => Ok(L2capSignalingPacketCode::LE_CREDIT_BASED_CONNECTION_REQ),
2287 21 => Ok(L2capSignalingPacketCode::LE_CREDIT_BASED_CONNECTION_RSP),
2288 22 => Ok(L2capSignalingPacketCode::FLOW_CONTROL_CREDIT_IND),
2289 23 => Ok(L2capSignalingPacketCode::CREDIT_BASED_CONNECTION_REQ),
2290 24 => Ok(L2capSignalingPacketCode::CREDIT_BASED_CONNECTION_RSP),
2291 25 => Ok(L2capSignalingPacketCode::CREDIT_BASED_RECONFIGURE_REQ),
2292 26 => Ok(L2capSignalingPacketCode::CREDIT_BASED_RECONFIGURE_RSP),
2293
2294 _ => Err(emboss_runtime::Error::UnknownEnum(val)),
2295 }
2296 }
2297}
2298
2299impl L2capSignalingPacketCode {
2300
2301}
2302#[derive(Copy, Clone, Debug, Eq, PartialEq)]
2303#[repr(u64)]
2304pub enum L2capFixedCid {
2305 ACL_U_SIGNALING = 1,
2306 CONNECTIONLESS = 2,
2307 ACL_U_SECURITY_MANAGER = 7,
2308 LE_U_ATTRIBUTE_PROTOCOL = 4,
2309 LE_U_SIGNALING = 5,
2310 LE_U_SECURITY_MANAGER = 6,
2311
2312}
2313
2314impl core::convert::From<L2capFixedCid> for u8 { fn from(val: L2capFixedCid) -> Self { val as u8 } }
2315impl core::convert::From<L2capFixedCid> for u16 { fn from(val: L2capFixedCid) -> Self { val as u16 } }
2316impl core::convert::From<L2capFixedCid> for u32 { fn from(val: L2capFixedCid) -> Self { val as u32 } }
2317impl core::convert::From<L2capFixedCid> for u64 { fn from(val: L2capFixedCid) -> Self { val as u64 } }
2318impl core::convert::From<L2capFixedCid> for i8 { fn from(val: L2capFixedCid) -> Self { val as i8 } }
2319impl core::convert::From<L2capFixedCid> for i16 { fn from(val: L2capFixedCid) -> Self { val as i16 } }
2320impl core::convert::From<L2capFixedCid> for i32 { fn from(val: L2capFixedCid) -> Self { val as i32 } }
2321impl core::convert::From<L2capFixedCid> for i64 { fn from(val: L2capFixedCid) -> Self { val as i64 } }
2322
2323impl emboss_runtime::SafeCmp<L2capFixedCid> for L2capFixedCid {
2324 fn safe_eq(&self, other: Self) -> bool { *self == other }
2325 fn safe_less(&self, other: Self) -> bool { (*self as u64) < (other as u64) }
2326}
2327
2328impl emboss_runtime::SafeCmp<u64> for L2capFixedCid {
2329 fn safe_eq(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
2330 fn safe_less(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
2331}
2332
2333impl emboss_runtime::SafeCmp<i64> for L2capFixedCid {
2334 fn safe_eq(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
2335 fn safe_less(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
2336}
2337
2338impl emboss_runtime::SafeCmp<i32> for L2capFixedCid {
2339 fn safe_eq(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as i64) }
2340 fn safe_less(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as i64) }
2341}
2342
2343impl emboss_runtime::SafeCmp<u32> for L2capFixedCid {
2344 fn safe_eq(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as u64) }
2345 fn safe_less(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as u64) }
2346}
2347
2348impl emboss_runtime::SafeCmp<L2capFixedCid> for u64 {
2349 fn safe_eq(&self, other: L2capFixedCid) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
2350 fn safe_less(&self, other: L2capFixedCid) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
2351}
2352
2353impl emboss_runtime::SafeCmp<L2capFixedCid> for i64 {
2354 fn safe_eq(&self, other: L2capFixedCid) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
2355 fn safe_less(&self, other: L2capFixedCid) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
2356}
2357
2358impl<V: core::convert::Into<u64> + core::marker::Copy> emboss_runtime::TryFromRaw<V> for L2capFixedCid {
2359 fn try_from_raw(val: V) -> core::result::Result<Self, emboss_runtime::Error<V>> {
2360 let v_raw: u64 = val.into();
2361 match v_raw {
2362 1 => Ok(L2capFixedCid::ACL_U_SIGNALING),
2363 2 => Ok(L2capFixedCid::CONNECTIONLESS),
2364 7 => Ok(L2capFixedCid::ACL_U_SECURITY_MANAGER),
2365 4 => Ok(L2capFixedCid::LE_U_ATTRIBUTE_PROTOCOL),
2366 5 => Ok(L2capFixedCid::LE_U_SIGNALING),
2367 6 => Ok(L2capFixedCid::LE_U_SECURITY_MANAGER),
2368
2369 _ => Err(emboss_runtime::Error::UnknownEnum(val)),
2370 }
2371 }
2372}
2373
2374impl L2capFixedCid {
2375
2376}
2377#[derive(Copy, Clone, Debug, Eq, PartialEq)]
2378#[repr(u64)]
2379pub enum L2capFixedPsmCode {
2380 SDP = 1,
2381 RFCOMM = 3,
2382 AVDTP = 25,
2383 ATT = 31,
2384 EATT = 39,
2385
2386}
2387
2388impl core::convert::From<L2capFixedPsmCode> for u8 { fn from(val: L2capFixedPsmCode) -> Self { val as u8 } }
2389impl core::convert::From<L2capFixedPsmCode> for u16 { fn from(val: L2capFixedPsmCode) -> Self { val as u16 } }
2390impl core::convert::From<L2capFixedPsmCode> for u32 { fn from(val: L2capFixedPsmCode) -> Self { val as u32 } }
2391impl core::convert::From<L2capFixedPsmCode> for u64 { fn from(val: L2capFixedPsmCode) -> Self { val as u64 } }
2392impl core::convert::From<L2capFixedPsmCode> for i8 { fn from(val: L2capFixedPsmCode) -> Self { val as i8 } }
2393impl core::convert::From<L2capFixedPsmCode> for i16 { fn from(val: L2capFixedPsmCode) -> Self { val as i16 } }
2394impl core::convert::From<L2capFixedPsmCode> for i32 { fn from(val: L2capFixedPsmCode) -> Self { val as i32 } }
2395impl core::convert::From<L2capFixedPsmCode> for i64 { fn from(val: L2capFixedPsmCode) -> Self { val as i64 } }
2396
2397impl emboss_runtime::SafeCmp<L2capFixedPsmCode> for L2capFixedPsmCode {
2398 fn safe_eq(&self, other: Self) -> bool { *self == other }
2399 fn safe_less(&self, other: Self) -> bool { (*self as u64) < (other as u64) }
2400}
2401
2402impl emboss_runtime::SafeCmp<u64> for L2capFixedPsmCode {
2403 fn safe_eq(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
2404 fn safe_less(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
2405}
2406
2407impl emboss_runtime::SafeCmp<i64> for L2capFixedPsmCode {
2408 fn safe_eq(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
2409 fn safe_less(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
2410}
2411
2412impl emboss_runtime::SafeCmp<i32> for L2capFixedPsmCode {
2413 fn safe_eq(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as i64) }
2414 fn safe_less(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as i64) }
2415}
2416
2417impl emboss_runtime::SafeCmp<u32> for L2capFixedPsmCode {
2418 fn safe_eq(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as u64) }
2419 fn safe_less(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as u64) }
2420}
2421
2422impl emboss_runtime::SafeCmp<L2capFixedPsmCode> for u64 {
2423 fn safe_eq(&self, other: L2capFixedPsmCode) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
2424 fn safe_less(&self, other: L2capFixedPsmCode) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
2425}
2426
2427impl emboss_runtime::SafeCmp<L2capFixedPsmCode> for i64 {
2428 fn safe_eq(&self, other: L2capFixedPsmCode) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
2429 fn safe_less(&self, other: L2capFixedPsmCode) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
2430}
2431
2432impl<V: core::convert::Into<u64> + core::marker::Copy> emboss_runtime::TryFromRaw<V> for L2capFixedPsmCode {
2433 fn try_from_raw(val: V) -> core::result::Result<Self, emboss_runtime::Error<V>> {
2434 let v_raw: u64 = val.into();
2435 match v_raw {
2436 1 => Ok(L2capFixedPsmCode::SDP),
2437 3 => Ok(L2capFixedPsmCode::RFCOMM),
2438 25 => Ok(L2capFixedPsmCode::AVDTP),
2439 31 => Ok(L2capFixedPsmCode::ATT),
2440 39 => Ok(L2capFixedPsmCode::EATT),
2441
2442 _ => Err(emboss_runtime::Error::UnknownEnum(val)),
2443 }
2444 }
2445}
2446
2447impl L2capFixedPsmCode {
2448
2449}
2450#[derive(Copy, Clone, Debug, Eq, PartialEq)]
2451#[repr(u64)]
2452pub enum L2capCommandRejectReasonCode {
2453 NOT_UNDERSTOOD = 0,
2454 SIG_MTU_EXCEEDED = 1,
2455 INVALID_CID = 2,
2456
2457}
2458
2459impl core::convert::From<L2capCommandRejectReasonCode> for u8 { fn from(val: L2capCommandRejectReasonCode) -> Self { val as u8 } }
2460impl core::convert::From<L2capCommandRejectReasonCode> for u16 { fn from(val: L2capCommandRejectReasonCode) -> Self { val as u16 } }
2461impl core::convert::From<L2capCommandRejectReasonCode> for u32 { fn from(val: L2capCommandRejectReasonCode) -> Self { val as u32 } }
2462impl core::convert::From<L2capCommandRejectReasonCode> for u64 { fn from(val: L2capCommandRejectReasonCode) -> Self { val as u64 } }
2463impl core::convert::From<L2capCommandRejectReasonCode> for i8 { fn from(val: L2capCommandRejectReasonCode) -> Self { val as i8 } }
2464impl core::convert::From<L2capCommandRejectReasonCode> for i16 { fn from(val: L2capCommandRejectReasonCode) -> Self { val as i16 } }
2465impl core::convert::From<L2capCommandRejectReasonCode> for i32 { fn from(val: L2capCommandRejectReasonCode) -> Self { val as i32 } }
2466impl core::convert::From<L2capCommandRejectReasonCode> for i64 { fn from(val: L2capCommandRejectReasonCode) -> Self { val as i64 } }
2467
2468impl emboss_runtime::SafeCmp<L2capCommandRejectReasonCode> for L2capCommandRejectReasonCode {
2469 fn safe_eq(&self, other: Self) -> bool { *self == other }
2470 fn safe_less(&self, other: Self) -> bool { (*self as u64) < (other as u64) }
2471}
2472
2473impl emboss_runtime::SafeCmp<u64> for L2capCommandRejectReasonCode {
2474 fn safe_eq(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
2475 fn safe_less(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
2476}
2477
2478impl emboss_runtime::SafeCmp<i64> for L2capCommandRejectReasonCode {
2479 fn safe_eq(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
2480 fn safe_less(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
2481}
2482
2483impl emboss_runtime::SafeCmp<i32> for L2capCommandRejectReasonCode {
2484 fn safe_eq(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as i64) }
2485 fn safe_less(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as i64) }
2486}
2487
2488impl emboss_runtime::SafeCmp<u32> for L2capCommandRejectReasonCode {
2489 fn safe_eq(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as u64) }
2490 fn safe_less(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as u64) }
2491}
2492
2493impl emboss_runtime::SafeCmp<L2capCommandRejectReasonCode> for u64 {
2494 fn safe_eq(&self, other: L2capCommandRejectReasonCode) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
2495 fn safe_less(&self, other: L2capCommandRejectReasonCode) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
2496}
2497
2498impl emboss_runtime::SafeCmp<L2capCommandRejectReasonCode> for i64 {
2499 fn safe_eq(&self, other: L2capCommandRejectReasonCode) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
2500 fn safe_less(&self, other: L2capCommandRejectReasonCode) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
2501}
2502
2503impl<V: core::convert::Into<u64> + core::marker::Copy> emboss_runtime::TryFromRaw<V> for L2capCommandRejectReasonCode {
2504 fn try_from_raw(val: V) -> core::result::Result<Self, emboss_runtime::Error<V>> {
2505 let v_raw: u64 = val.into();
2506 match v_raw {
2507 0 => Ok(L2capCommandRejectReasonCode::NOT_UNDERSTOOD),
2508 1 => Ok(L2capCommandRejectReasonCode::SIG_MTU_EXCEEDED),
2509 2 => Ok(L2capCommandRejectReasonCode::INVALID_CID),
2510
2511 _ => Err(emboss_runtime::Error::UnknownEnum(val)),
2512 }
2513 }
2514}
2515
2516impl L2capCommandRejectReasonCode {
2517
2518}
2519#[derive(Copy, Clone, Debug, Eq, PartialEq)]
2520#[repr(u64)]
2521pub enum L2capConfigurationOptionType {
2522 MTU = 1,
2523
2524}
2525
2526impl core::convert::From<L2capConfigurationOptionType> for u8 { fn from(val: L2capConfigurationOptionType) -> Self { val as u8 } }
2527impl core::convert::From<L2capConfigurationOptionType> for u16 { fn from(val: L2capConfigurationOptionType) -> Self { val as u16 } }
2528impl core::convert::From<L2capConfigurationOptionType> for u32 { fn from(val: L2capConfigurationOptionType) -> Self { val as u32 } }
2529impl core::convert::From<L2capConfigurationOptionType> for u64 { fn from(val: L2capConfigurationOptionType) -> Self { val as u64 } }
2530impl core::convert::From<L2capConfigurationOptionType> for i8 { fn from(val: L2capConfigurationOptionType) -> Self { val as i8 } }
2531impl core::convert::From<L2capConfigurationOptionType> for i16 { fn from(val: L2capConfigurationOptionType) -> Self { val as i16 } }
2532impl core::convert::From<L2capConfigurationOptionType> for i32 { fn from(val: L2capConfigurationOptionType) -> Self { val as i32 } }
2533impl core::convert::From<L2capConfigurationOptionType> for i64 { fn from(val: L2capConfigurationOptionType) -> Self { val as i64 } }
2534
2535impl emboss_runtime::SafeCmp<L2capConfigurationOptionType> for L2capConfigurationOptionType {
2536 fn safe_eq(&self, other: Self) -> bool { *self == other }
2537 fn safe_less(&self, other: Self) -> bool { (*self as u64) < (other as u64) }
2538}
2539
2540impl emboss_runtime::SafeCmp<u64> for L2capConfigurationOptionType {
2541 fn safe_eq(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
2542 fn safe_less(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
2543}
2544
2545impl emboss_runtime::SafeCmp<i64> for L2capConfigurationOptionType {
2546 fn safe_eq(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
2547 fn safe_less(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
2548}
2549
2550impl emboss_runtime::SafeCmp<i32> for L2capConfigurationOptionType {
2551 fn safe_eq(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as i64) }
2552 fn safe_less(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as i64) }
2553}
2554
2555impl emboss_runtime::SafeCmp<u32> for L2capConfigurationOptionType {
2556 fn safe_eq(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as u64) }
2557 fn safe_less(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as u64) }
2558}
2559
2560impl emboss_runtime::SafeCmp<L2capConfigurationOptionType> for u64 {
2561 fn safe_eq(&self, other: L2capConfigurationOptionType) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
2562 fn safe_less(&self, other: L2capConfigurationOptionType) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
2563}
2564
2565impl emboss_runtime::SafeCmp<L2capConfigurationOptionType> for i64 {
2566 fn safe_eq(&self, other: L2capConfigurationOptionType) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
2567 fn safe_less(&self, other: L2capConfigurationOptionType) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
2568}
2569
2570impl<V: core::convert::Into<u64> + core::marker::Copy> emboss_runtime::TryFromRaw<V> for L2capConfigurationOptionType {
2571 fn try_from_raw(val: V) -> core::result::Result<Self, emboss_runtime::Error<V>> {
2572 let v_raw: u64 = val.into();
2573 match v_raw {
2574 1 => Ok(L2capConfigurationOptionType::MTU),
2575
2576 _ => Err(emboss_runtime::Error::UnknownEnum(val)),
2577 }
2578 }
2579}
2580
2581impl L2capConfigurationOptionType {
2582
2583}
2584#[derive(Copy, Clone, Debug, Eq, PartialEq)]
2585#[repr(u64)]
2586pub enum L2capConfigurationResult {
2587 SUCCESS = 0,
2588 FAILURE_UNACCEPTABLE_PARAMETERS = 1,
2589 FAILURE_REJECTED = 2,
2590 FAILURE_UNKNOWN_OPTIONS = 3,
2591 PENDING = 4,
2592 FAILURE_FLOW_SPEC_REJECT = 5,
2593
2594}
2595
2596impl core::convert::From<L2capConfigurationResult> for u8 { fn from(val: L2capConfigurationResult) -> Self { val as u8 } }
2597impl core::convert::From<L2capConfigurationResult> for u16 { fn from(val: L2capConfigurationResult) -> Self { val as u16 } }
2598impl core::convert::From<L2capConfigurationResult> for u32 { fn from(val: L2capConfigurationResult) -> Self { val as u32 } }
2599impl core::convert::From<L2capConfigurationResult> for u64 { fn from(val: L2capConfigurationResult) -> Self { val as u64 } }
2600impl core::convert::From<L2capConfigurationResult> for i8 { fn from(val: L2capConfigurationResult) -> Self { val as i8 } }
2601impl core::convert::From<L2capConfigurationResult> for i16 { fn from(val: L2capConfigurationResult) -> Self { val as i16 } }
2602impl core::convert::From<L2capConfigurationResult> for i32 { fn from(val: L2capConfigurationResult) -> Self { val as i32 } }
2603impl core::convert::From<L2capConfigurationResult> for i64 { fn from(val: L2capConfigurationResult) -> Self { val as i64 } }
2604
2605impl emboss_runtime::SafeCmp<L2capConfigurationResult> for L2capConfigurationResult {
2606 fn safe_eq(&self, other: Self) -> bool { *self == other }
2607 fn safe_less(&self, other: Self) -> bool { (*self as u64) < (other as u64) }
2608}
2609
2610impl emboss_runtime::SafeCmp<u64> for L2capConfigurationResult {
2611 fn safe_eq(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
2612 fn safe_less(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
2613}
2614
2615impl emboss_runtime::SafeCmp<i64> for L2capConfigurationResult {
2616 fn safe_eq(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
2617 fn safe_less(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
2618}
2619
2620impl emboss_runtime::SafeCmp<i32> for L2capConfigurationResult {
2621 fn safe_eq(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as i64) }
2622 fn safe_less(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as i64) }
2623}
2624
2625impl emboss_runtime::SafeCmp<u32> for L2capConfigurationResult {
2626 fn safe_eq(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as u64) }
2627 fn safe_less(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as u64) }
2628}
2629
2630impl emboss_runtime::SafeCmp<L2capConfigurationResult> for u64 {
2631 fn safe_eq(&self, other: L2capConfigurationResult) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
2632 fn safe_less(&self, other: L2capConfigurationResult) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
2633}
2634
2635impl emboss_runtime::SafeCmp<L2capConfigurationResult> for i64 {
2636 fn safe_eq(&self, other: L2capConfigurationResult) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
2637 fn safe_less(&self, other: L2capConfigurationResult) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
2638}
2639
2640impl<V: core::convert::Into<u64> + core::marker::Copy> emboss_runtime::TryFromRaw<V> for L2capConfigurationResult {
2641 fn try_from_raw(val: V) -> core::result::Result<Self, emboss_runtime::Error<V>> {
2642 let v_raw: u64 = val.into();
2643 match v_raw {
2644 0 => Ok(L2capConfigurationResult::SUCCESS),
2645 1 => Ok(L2capConfigurationResult::FAILURE_UNACCEPTABLE_PARAMETERS),
2646 2 => Ok(L2capConfigurationResult::FAILURE_REJECTED),
2647 3 => Ok(L2capConfigurationResult::FAILURE_UNKNOWN_OPTIONS),
2648 4 => Ok(L2capConfigurationResult::PENDING),
2649 5 => Ok(L2capConfigurationResult::FAILURE_FLOW_SPEC_REJECT),
2650
2651 _ => Err(emboss_runtime::Error::UnknownEnum(val)),
2652 }
2653 }
2654}
2655
2656impl L2capConfigurationResult {
2657
2658}
2659pub struct L2capConfigurationOptionHeader<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
2660 storage: S,
2661 _marker: core::marker::PhantomData<ST>,
2662}
2663
2664impl<S: emboss_runtime::Storage> L2capConfigurationOptionHeader<S, emboss_runtime::UncheckedState> {
2665 pub fn new(storage: S) -> Self {
2666 Self {
2667 storage,
2668 _marker: core::marker::PhantomData,
2669 }
2670 }
2671}
2672
2673impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capConfigurationOptionHeader<S, ST> {
2674 fn clone(&self) -> Self {
2675 Self {
2676 storage: self.storage.clone(),
2677 _marker: core::marker::PhantomData,
2678 }
2679 }
2680}
2681
2682impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capConfigurationOptionHeader<S, ST> {
2683 pub unsafe fn new_in_state(storage: S) -> Self {
2691 Self {
2692 storage,
2693 _marker: core::marker::PhantomData,
2694 }
2695 }
2696 pub fn into_storage(self) -> S {
2697 self.storage
2698 }
2699 pub fn option_type(&self) -> emboss_runtime::EnumView<L2capConfigurationOptionType, emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>> {
2700 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
2701 let offset = (0) as usize;
2702 let len = (1) as usize;
2703 core::result::Result::Ok((offset, len))
2704 })().unwrap_or((usize::MAX, 0));
2705 let storage = self.storage.slice(offset, len);
2706 emboss_runtime::EnumView::new(emboss_runtime::UInt::new(storage))
2707 }
2708 pub fn option_length(&self) -> UInt<8, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
2709 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
2710 let offset = (1) as usize;
2711 let len = (1) as usize;
2712 core::result::Result::Ok((offset, len))
2713 })().unwrap_or((usize::MAX, 0));
2714 let storage = self.storage.slice(offset, len);
2715 UInt::<8, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
2716 }
2717
2718}
2719
2720pub struct L2capConfigurationOptionHeaderMut<S: emboss_runtime::MutStorage> {
2721 storage: S,
2722}
2723
2724impl<S: emboss_runtime::MutStorage> L2capConfigurationOptionHeaderMut<S> {
2725 pub fn new(storage: S) -> Self {
2726 Self {
2727 storage,
2728 }
2729 }
2730 pub fn into_writer(self) -> L2capConfigurationOptionHeaderWriter<S, emboss_runtime::UncheckedState> {
2731 L2capConfigurationOptionHeaderWriter::new(self.storage)
2732 }
2733 pub fn as_view(&self) -> L2capConfigurationOptionHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
2735 unsafe { L2capConfigurationOptionHeader::new_in_state(self.storage.slice(0, self.storage.len())) }
2736 }
2737 pub fn option_type(&mut self) -> emboss_runtime::EnumViewMut<L2capConfigurationOptionType, emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>> {
2738 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
2739 let offset = (0) as usize;
2740 let len = (1) as usize;
2741 core::result::Result::Ok((offset, len))
2742 })().unwrap_or((usize::MAX, 0));
2743 let storage = self.storage.slice_mut(offset, len);
2744 emboss_runtime::EnumViewMut::new(emboss_runtime::UInt::new(storage))
2745 }
2746 pub fn option_length(&mut self) -> UInt<8, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
2747 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
2748 let offset = (1) as usize;
2749 let len = (1) as usize;
2750 core::result::Result::Ok((offset, len))
2751 })().unwrap_or((usize::MAX, 0));
2752 let storage = self.storage.slice_mut(offset, len);
2753 UInt::<8, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
2754 }
2755
2756}
2757
2758impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capConfigurationOptionHeaderMut<S> {
2759 type Writer = L2capConfigurationOptionHeaderWriter<S, emboss_runtime::UncheckedState>;
2760 fn into_writer(self) -> Self::Writer {
2761 L2capConfigurationOptionHeaderWriter::new(self.storage)
2762 }
2763}
2764
2765pub struct L2capConfigurationOptionHeaderWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
2766 storage: S,
2767 _marker: core::marker::PhantomData<ST>,
2768}
2769
2770impl<S: emboss_runtime::MutStorage> L2capConfigurationOptionHeaderWriter<S, emboss_runtime::UncheckedState> {
2771 pub fn new(storage: S) -> Self {
2772 Self {
2773 storage,
2774 _marker: core::marker::PhantomData,
2775 }
2776 }
2777}
2778
2779impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capConfigurationOptionHeaderWriter<S, ST> {
2780 pub unsafe fn new_in_state(storage: S) -> Self {
2788 Self {
2789 storage,
2790 _marker: core::marker::PhantomData,
2791 }
2792 }
2793 pub fn into_storage(self) -> S {
2794 self.storage
2795 }
2796 pub fn into_view(self) -> L2capConfigurationOptionHeader<S, ST> {
2798 unsafe { L2capConfigurationOptionHeader::new_in_state(self.storage) }
2799 }
2800 pub fn as_view(&self) -> L2capConfigurationOptionHeader<S::Sliced<'_>, ST> {
2802 unsafe { L2capConfigurationOptionHeader::new_in_state(self.storage.slice(0, self.storage.len())) }
2803 }
2804 pub fn write_option_type(self, val: L2capConfigurationOptionType) -> L2capConfigurationOptionHeaderWriter<S, ST::OnValidMutation> {
2805 let view = self.into_view();
2806 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
2807 let offset = (0) as usize;
2808 let len = (1) as usize;
2809 core::result::Result::Ok((offset, len))
2810 })().expect("valid layout in complete state");
2811 let mut storage = view.into_storage();
2812 {
2813 let slice = storage.slice_mut(offset, len);
2814 let mut field_view = emboss_runtime::EnumViewMut::<L2capConfigurationOptionType, emboss_runtime::UInt<8, emboss_runtime::LittleEndian, _>>::new(emboss_runtime::UInt::new(slice));
2815 field_view.try_write(val).expect("valid write in complete state");
2816 }
2817 unsafe { L2capConfigurationOptionHeaderWriter::new_in_state(storage) }
2818 }
2819 pub fn write_option_length(self, val: <emboss_runtime::SizeSelector<8> as emboss_runtime::SmallestUInt>::T) -> L2capConfigurationOptionHeaderWriter<S, ST::OnValidMutation> {
2820 let view = self.into_view();
2821 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
2822 let offset = (1) as usize;
2823 let len = (1) as usize;
2824 core::result::Result::Ok((offset, len))
2825 })().expect("valid layout in complete state");
2826 let mut storage = view.into_storage();
2827 {
2828 let slice = storage.slice_mut(offset, len);
2829 let mut field_view = emboss_runtime::UInt::<8, emboss_runtime::LittleEndian, _>::new(slice);
2830 field_view.try_write(val).expect("valid write in complete state");
2831 }
2832 unsafe { L2capConfigurationOptionHeaderWriter::new_in_state(storage) }
2833 }
2834
2835}
2836
2837impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capConfigurationOptionHeader<S, ST> {
2838 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
2839 let view = self;
2840 core::result::Result::Ok((2) as usize)
2841 }
2842}
2843
2844impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capConfigurationOptionHeaderMut<S> {
2845 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
2846 let view = self.as_view();
2847 <L2capConfigurationOptionHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
2848 }
2849}
2850
2851impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capConfigurationOptionHeaderWriter<S, ST> {
2852 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
2853 let view = self.as_view();
2854 <L2capConfigurationOptionHeader<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
2855 }
2856}
2857
2858impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capConfigurationOptionHeader<S, emboss_runtime::UncheckedState> {
2859 type Completed = L2capConfigurationOptionHeader<S, emboss_runtime::CompleteState>;
2860 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
2861 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
2862 if self.storage.len() < required_size {
2863 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
2864 }
2865 core::result::Result::Ok(unsafe { L2capConfigurationOptionHeader::new_in_state(self.storage) })
2866 }
2867}
2868
2869impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capConfigurationOptionHeaderWriter<S, emboss_runtime::UncheckedState> {
2870 type Completed = L2capConfigurationOptionHeaderWriter<S, emboss_runtime::CompleteState>;
2871 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
2872 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
2873 if self.storage.len() < required_size {
2874 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
2875 }
2876 core::result::Result::Ok(unsafe { L2capConfigurationOptionHeaderWriter::new_in_state(self.storage) })
2877 }
2878}
2879
2880impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigurationOptionHeader<S, emboss_runtime::UncheckedState> {
2881 type Ok = L2capConfigurationOptionHeader<S, emboss_runtime::OkState>;
2882 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
2883 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
2884 core::result::Result::Ok(unsafe { L2capConfigurationOptionHeader::new_in_state(completed.into_storage()) })
2885 }
2886}
2887
2888impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigurationOptionHeader<S, emboss_runtime::CompleteState> {
2889 type Ok = L2capConfigurationOptionHeader<S, emboss_runtime::OkState>;
2890 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
2891 core::result::Result::Ok(unsafe { L2capConfigurationOptionHeader::new_in_state(self.into_storage()) })
2892 }
2893}
2894
2895impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigurationOptionHeader<S, emboss_runtime::OkState> {
2896 type Ok = L2capConfigurationOptionHeader<S, emboss_runtime::OkState>;
2897 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
2898 core::result::Result::Ok(self)
2899 }
2900}
2901
2902impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigurationOptionHeaderWriter<S, emboss_runtime::UncheckedState> {
2903 type Ok = L2capConfigurationOptionHeaderWriter<S, emboss_runtime::OkState>;
2904 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
2905 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
2906 core::result::Result::Ok(unsafe { L2capConfigurationOptionHeaderWriter::new_in_state(completed.into_storage()) })
2907 }
2908}
2909
2910impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigurationOptionHeaderWriter<S, emboss_runtime::CompleteState> {
2911 type Ok = L2capConfigurationOptionHeaderWriter<S, emboss_runtime::OkState>;
2912 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
2913 core::result::Result::Ok(unsafe { L2capConfigurationOptionHeaderWriter::new_in_state(self.into_storage()) })
2914 }
2915}
2916
2917impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigurationOptionHeaderWriter<S, emboss_runtime::OkState> {
2918 type Ok = L2capConfigurationOptionHeaderWriter<S, emboss_runtime::OkState>;
2919 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
2920 core::result::Result::Ok(self)
2921 }
2922}
2923
2924pub mod l2cap_configuration_option_header {
2925 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capConfigurationOptionHeader<S, ST>;
2926 pub type ViewMut<S> = super::L2capConfigurationOptionHeaderMut<S>;
2927 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capConfigurationOptionHeaderWriter<S, ST>;
2928
2929 pub const MIN_SIZE_IN_BYTES: usize = 2;
2930 pub const MAX_SIZE_IN_BYTES: usize = 2;
2931 pub const SIZE_IN_BYTES: usize = 2;
2932}pub struct L2capMtuConfigurationOption<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
2933 storage: S,
2934 _marker: core::marker::PhantomData<ST>,
2935}
2936
2937impl<S: emboss_runtime::Storage> L2capMtuConfigurationOption<S, emboss_runtime::UncheckedState> {
2938 pub fn new(storage: S) -> Self {
2939 Self {
2940 storage,
2941 _marker: core::marker::PhantomData,
2942 }
2943 }
2944}
2945
2946impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capMtuConfigurationOption<S, ST> {
2947 fn clone(&self) -> Self {
2948 Self {
2949 storage: self.storage.clone(),
2950 _marker: core::marker::PhantomData,
2951 }
2952 }
2953}
2954
2955impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capMtuConfigurationOption<S, ST> {
2956 pub unsafe fn new_in_state(storage: S) -> Self {
2964 Self {
2965 storage,
2966 _marker: core::marker::PhantomData,
2967 }
2968 }
2969 pub fn into_storage(self) -> S {
2970 self.storage
2971 }
2972 pub fn header(&self) -> L2capConfigurationOptionHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
2973 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
2974 let offset = (0) as usize;
2975 let len = (2) as usize;
2976 core::result::Result::Ok((offset, len))
2977 })().unwrap_or((usize::MAX, 0));
2978 let storage = self.storage.slice(offset, len);
2979 unsafe { L2capConfigurationOptionHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
2980 }
2981 pub fn mtu(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
2982 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
2983 let offset = (2) as usize;
2984 let len = (2) as usize;
2985 core::result::Result::Ok((offset, len))
2986 })().unwrap_or((usize::MAX, 0));
2987 let storage = self.storage.slice(offset, len);
2988 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
2989 }
2990
2991}
2992
2993pub struct L2capMtuConfigurationOptionMut<S: emboss_runtime::MutStorage> {
2994 storage: S,
2995}
2996
2997impl<S: emboss_runtime::MutStorage> L2capMtuConfigurationOptionMut<S> {
2998 pub fn new(storage: S) -> Self {
2999 Self {
3000 storage,
3001 }
3002 }
3003 pub fn into_writer(self) -> L2capMtuConfigurationOptionWriter<S, emboss_runtime::UncheckedState> {
3004 L2capMtuConfigurationOptionWriter::new(self.storage)
3005 }
3006 pub fn as_view(&self) -> L2capMtuConfigurationOption<S::Sliced<'_>, emboss_runtime::UncheckedState> {
3008 unsafe { L2capMtuConfigurationOption::new_in_state(self.storage.slice(0, self.storage.len())) }
3009 }
3010 pub fn header(&mut self) -> L2capConfigurationOptionHeaderMut<S::SlicedMut<'_>> {
3011 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3012 let offset = (0) as usize;
3013 let len = (2) as usize;
3014 core::result::Result::Ok((offset, len))
3015 })().unwrap_or((usize::MAX, 0));
3016 let storage = self.storage.slice_mut(offset, len);
3017 L2capConfigurationOptionHeaderMut::<S::SlicedMut<'_>>::new(storage)
3018 }
3019 pub fn mtu(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
3020 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3021 let offset = (2) as usize;
3022 let len = (2) as usize;
3023 core::result::Result::Ok((offset, len))
3024 })().unwrap_or((usize::MAX, 0));
3025 let storage = self.storage.slice_mut(offset, len);
3026 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
3027 }
3028
3029}
3030
3031impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capMtuConfigurationOptionMut<S> {
3032 type Writer = L2capMtuConfigurationOptionWriter<S, emboss_runtime::UncheckedState>;
3033 fn into_writer(self) -> Self::Writer {
3034 L2capMtuConfigurationOptionWriter::new(self.storage)
3035 }
3036}
3037
3038pub struct L2capMtuConfigurationOptionWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
3039 storage: S,
3040 _marker: core::marker::PhantomData<ST>,
3041}
3042
3043impl<S: emboss_runtime::MutStorage> L2capMtuConfigurationOptionWriter<S, emboss_runtime::UncheckedState> {
3044 pub fn new(storage: S) -> Self {
3045 Self {
3046 storage,
3047 _marker: core::marker::PhantomData,
3048 }
3049 }
3050}
3051
3052impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capMtuConfigurationOptionWriter<S, ST> {
3053 pub unsafe fn new_in_state(storage: S) -> Self {
3061 Self {
3062 storage,
3063 _marker: core::marker::PhantomData,
3064 }
3065 }
3066 pub fn into_storage(self) -> S {
3067 self.storage
3068 }
3069 pub fn into_view(self) -> L2capMtuConfigurationOption<S, ST> {
3071 unsafe { L2capMtuConfigurationOption::new_in_state(self.storage) }
3072 }
3073 pub fn as_view(&self) -> L2capMtuConfigurationOption<S::Sliced<'_>, ST> {
3075 unsafe { L2capMtuConfigurationOption::new_in_state(self.storage.slice(0, self.storage.len())) }
3076 }
3077 pub fn write_mtu(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capMtuConfigurationOptionWriter<S, ST::OnValidMutation> {
3078 let view = self.into_view();
3079 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3080 let offset = (2) as usize;
3081 let len = (2) as usize;
3082 core::result::Result::Ok((offset, len))
3083 })().expect("valid layout in complete state");
3084 let mut storage = view.into_storage();
3085 {
3086 let slice = storage.slice_mut(offset, len);
3087 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
3088 field_view.try_write(val).expect("valid write in complete state");
3089 }
3090 unsafe { L2capMtuConfigurationOptionWriter::new_in_state(storage) }
3091 }
3092
3093}
3094
3095impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capMtuConfigurationOption<S, ST> {
3096 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
3097 let view = self;
3098 core::result::Result::Ok((4) as usize)
3099 }
3100}
3101
3102impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capMtuConfigurationOptionMut<S> {
3103 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
3104 let view = self.as_view();
3105 <L2capMtuConfigurationOption<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
3106 }
3107}
3108
3109impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capMtuConfigurationOptionWriter<S, ST> {
3110 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
3111 let view = self.as_view();
3112 <L2capMtuConfigurationOption<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
3113 }
3114}
3115
3116impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capMtuConfigurationOption<S, emboss_runtime::UncheckedState> {
3117 type Completed = L2capMtuConfigurationOption<S, emboss_runtime::CompleteState>;
3118 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
3119 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
3120 if self.storage.len() < required_size {
3121 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
3122 }
3123 core::result::Result::Ok(unsafe { L2capMtuConfigurationOption::new_in_state(self.storage) })
3124 }
3125}
3126
3127impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capMtuConfigurationOptionWriter<S, emboss_runtime::UncheckedState> {
3128 type Completed = L2capMtuConfigurationOptionWriter<S, emboss_runtime::CompleteState>;
3129 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
3130 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
3131 if self.storage.len() < required_size {
3132 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
3133 }
3134 core::result::Result::Ok(unsafe { L2capMtuConfigurationOptionWriter::new_in_state(self.storage) })
3135 }
3136}
3137
3138impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capMtuConfigurationOption<S, emboss_runtime::UncheckedState> {
3139 type Ok = L2capMtuConfigurationOption<S, emboss_runtime::OkState>;
3140 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3141 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
3142 core::result::Result::Ok(unsafe { L2capMtuConfigurationOption::new_in_state(completed.into_storage()) })
3143 }
3144}
3145
3146impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capMtuConfigurationOption<S, emboss_runtime::CompleteState> {
3147 type Ok = L2capMtuConfigurationOption<S, emboss_runtime::OkState>;
3148 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3149 core::result::Result::Ok(unsafe { L2capMtuConfigurationOption::new_in_state(self.into_storage()) })
3150 }
3151}
3152
3153impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capMtuConfigurationOption<S, emboss_runtime::OkState> {
3154 type Ok = L2capMtuConfigurationOption<S, emboss_runtime::OkState>;
3155 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3156 core::result::Result::Ok(self)
3157 }
3158}
3159
3160impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capMtuConfigurationOptionWriter<S, emboss_runtime::UncheckedState> {
3161 type Ok = L2capMtuConfigurationOptionWriter<S, emboss_runtime::OkState>;
3162 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3163 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
3164 core::result::Result::Ok(unsafe { L2capMtuConfigurationOptionWriter::new_in_state(completed.into_storage()) })
3165 }
3166}
3167
3168impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capMtuConfigurationOptionWriter<S, emboss_runtime::CompleteState> {
3169 type Ok = L2capMtuConfigurationOptionWriter<S, emboss_runtime::OkState>;
3170 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3171 core::result::Result::Ok(unsafe { L2capMtuConfigurationOptionWriter::new_in_state(self.into_storage()) })
3172 }
3173}
3174
3175impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capMtuConfigurationOptionWriter<S, emboss_runtime::OkState> {
3176 type Ok = L2capMtuConfigurationOptionWriter<S, emboss_runtime::OkState>;
3177 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3178 core::result::Result::Ok(self)
3179 }
3180}
3181
3182pub mod l2cap_mtu_configuration_option {
3183 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capMtuConfigurationOption<S, ST>;
3184 pub type ViewMut<S> = super::L2capMtuConfigurationOptionMut<S>;
3185 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capMtuConfigurationOptionWriter<S, ST>;
3186
3187 pub const MIN_SIZE_IN_BYTES: usize = 4;
3188 pub const MAX_SIZE_IN_BYTES: usize = 4;
3189 pub const SIZE_IN_BYTES: usize = 4;
3190}pub struct CFrame_Payload_ArrayView<S: emboss_runtime::Storage> {
3191 storage: S,
3192 element_count: usize,
3193}
3194
3195impl<S: emboss_runtime::Storage + core::clone::Clone> core::clone::Clone for CFrame_Payload_ArrayView<S> {
3196 fn clone(&self) -> Self {
3197 Self {
3198 storage: self.storage.clone(),
3199 element_count: self.element_count,
3200 }
3201 }
3202}
3203
3204impl<S: emboss_runtime::Storage> CFrame_Payload_ArrayView<S> {
3205 pub const ELEMENT_SIZE_BYTES: usize = 1;
3206 pub fn new(storage: S, element_count: usize) -> Self {
3207 Self { storage, element_count }
3208 }
3209 pub fn element_count(&self) -> usize {
3210 self.element_count
3211 }
3212 pub fn get(&self, index: usize) -> core::result::Result<emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::Sliced<'_>>
3213, emboss_runtime::Error> {
3214 if index >= self.element_count {
3215 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
3216 }
3217 let offset = index * Self::ELEMENT_SIZE_BYTES;
3218 let storage = self.storage.slice(offset, Self::ELEMENT_SIZE_BYTES);
3219 core::result::Result::Ok(emboss_runtime::UInt::new(storage)
3220)
3221 }
3222}
3223
3224pub struct CFrame_Payload_ArrayViewMut<S: emboss_runtime::MutStorage> {
3225 storage: S,
3226 element_count: usize,
3227}
3228
3229impl<S: emboss_runtime::MutStorage> CFrame_Payload_ArrayViewMut<S> {
3230 pub const ELEMENT_SIZE_BYTES: usize = 1;
3231 pub fn new(storage: S, element_count: usize) -> Self {
3232 Self { storage, element_count }
3233 }
3234 pub fn element_count(&self) -> usize {
3235 self.element_count
3236 }
3237 pub fn get_mut(&mut self, index: usize) -> core::result::Result<emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::SlicedMut<'_>>
3238, emboss_runtime::Error> {
3239 if index >= self.element_count {
3240 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
3241 }
3242 let offset = index * Self::ELEMENT_SIZE_BYTES;
3243 let storage = self.storage.slice_mut(offset, Self::ELEMENT_SIZE_BYTES);
3244 core::result::Result::Ok(emboss_runtime::UInt::new(storage)
3245)
3246 }
3247}
3248pub struct CFrame<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
3249 storage: S,
3250 _marker: core::marker::PhantomData<ST>,
3251}
3252
3253impl<S: emboss_runtime::Storage> CFrame<S, emboss_runtime::UncheckedState> {
3254 pub fn new(storage: S) -> Self {
3255 Self {
3256 storage,
3257 _marker: core::marker::PhantomData,
3258 }
3259 }
3260}
3261
3262impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for CFrame<S, ST> {
3263 fn clone(&self) -> Self {
3264 Self {
3265 storage: self.storage.clone(),
3266 _marker: core::marker::PhantomData,
3267 }
3268 }
3269}
3270
3271impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> CFrame<S, ST> {
3272 pub unsafe fn new_in_state(storage: S) -> Self {
3280 Self {
3281 storage,
3282 _marker: core::marker::PhantomData,
3283 }
3284 }
3285 pub fn into_storage(self) -> S {
3286 self.storage
3287 }
3288 pub fn header(&self) -> BasicL2capHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
3289 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3290 let offset = (0) as usize;
3291 let len = (4) as usize;
3292 core::result::Result::Ok((offset, len))
3293 })().unwrap_or((usize::MAX, 0));
3294 let storage = self.storage.slice(offset, len);
3295 unsafe { BasicL2capHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
3296 }
3297 pub fn pdu_length(&self) -> emboss_runtime::VirtualField<u64> {
3298 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
3299 core::result::Result::Ok( (({ let val = self.header().pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
3300) as u64 )
3301 })();
3302 emboss_runtime::VirtualField::new(value)
3303 }
3304 pub fn channel_id(&self) -> emboss_runtime::VirtualField<u64> {
3305 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
3306 core::result::Result::Ok( (({ let val = self.header().channel_id().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
3307) as u64 )
3308 })();
3309 emboss_runtime::VirtualField::new(value)
3310 }
3311 pub fn payload(&self) -> core::result::Result<CFrame_Payload_ArrayView<S::Sliced<'_>>, emboss_runtime::Error> {
3312 let offset_res = (|| -> core::result::Result<(usize, usize, usize), emboss_runtime::Error> {
3313 let offset = (4) as usize;
3314 let len = (({ let val = self.pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
3315) as usize;
3316 let element_count = (len / (1)) as usize;
3317 core::result::Result::Ok((offset, len, element_count))
3318 })();
3319 match offset_res {
3320 core::result::Result::Ok((offset, len, element_count)) => {
3321 if len > 0 {
3322 let end = offset.checked_add(len).ok_or(emboss_runtime::Error::OutOfBounds)?;
3323 self.storage.try_read_byte(end - 1)?;
3324 }
3325 let storage = self.storage.slice(offset, len);
3326 core::result::Result::Ok(CFrame_Payload_ArrayView::new(storage, element_count))
3327 },
3328 core::result::Result::Err(e) => core::result::Result::Err(e),
3329 }
3330 }
3331
3332}
3333
3334pub struct CFrameMut<S: emboss_runtime::MutStorage> {
3335 storage: S,
3336}
3337
3338impl<S: emboss_runtime::MutStorage> CFrameMut<S> {
3339 pub fn new(storage: S) -> Self {
3340 Self {
3341 storage,
3342 }
3343 }
3344 pub fn into_writer(self) -> CFrameWriter<S, emboss_runtime::UncheckedState> {
3345 CFrameWriter::new(self.storage)
3346 }
3347 pub fn as_view(&self) -> CFrame<S::Sliced<'_>, emboss_runtime::UncheckedState> {
3349 unsafe { CFrame::new_in_state(self.storage.slice(0, self.storage.len())) }
3350 }
3351 pub fn header(&mut self) -> BasicL2capHeaderMut<S::SlicedMut<'_>> {
3352 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3353 let offset = (0) as usize;
3354 let len = (4) as usize;
3355 core::result::Result::Ok((offset, len))
3356 })().unwrap_or((usize::MAX, 0));
3357 let storage = self.storage.slice_mut(offset, len);
3358 BasicL2capHeaderMut::<S::SlicedMut<'_>>::new(storage)
3359 }
3360 pub fn pdu_length(&mut self) -> emboss_runtime::VirtualField<u64> {
3361 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
3362 core::result::Result::Ok( (({ let val = self.header().pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
3363) as u64 )
3364 })();
3365 emboss_runtime::VirtualField::new(value)
3366 }
3367 pub fn channel_id(&mut self) -> emboss_runtime::VirtualField<u64> {
3368 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
3369 core::result::Result::Ok( (({ let val = self.header().channel_id().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
3370) as u64 )
3371 })();
3372 emboss_runtime::VirtualField::new(value)
3373 }
3374 pub fn payload_mut(&mut self) -> core::result::Result<CFrame_Payload_ArrayViewMut<S::SlicedMut<'_>>, emboss_runtime::Error> {
3375 let offset_res = (|| -> core::result::Result<(usize, usize, usize), emboss_runtime::Error> {
3376 let offset = (4) as usize;
3377 let len = (({ let val = self.pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
3378) as usize;
3379 let element_count = (len / (1)) as usize;
3380 core::result::Result::Ok((offset, len, element_count))
3381 })();
3382 match offset_res {
3383 core::result::Result::Ok((offset, len, element_count)) => {
3384 if len > 0 {
3385 let end = offset.checked_add(len).ok_or(emboss_runtime::Error::OutOfBounds)?;
3386 self.storage.try_read_byte(end - 1)?;
3387 }
3388 let storage = self.storage.slice_mut(offset, len);
3389 core::result::Result::Ok(CFrame_Payload_ArrayViewMut::new(storage, element_count))
3390 },
3391 core::result::Result::Err(e) => core::result::Result::Err(e),
3392 }
3393 }
3394
3395}
3396
3397impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for CFrameMut<S> {
3398 type Writer = CFrameWriter<S, emboss_runtime::UncheckedState>;
3399 fn into_writer(self) -> Self::Writer {
3400 CFrameWriter::new(self.storage)
3401 }
3402}
3403
3404pub struct CFrameWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
3405 storage: S,
3406 _marker: core::marker::PhantomData<ST>,
3407}
3408
3409impl<S: emboss_runtime::MutStorage> CFrameWriter<S, emboss_runtime::UncheckedState> {
3410 pub fn new(storage: S) -> Self {
3411 Self {
3412 storage,
3413 _marker: core::marker::PhantomData,
3414 }
3415 }
3416}
3417
3418impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> CFrameWriter<S, ST> {
3419 pub unsafe fn new_in_state(storage: S) -> Self {
3427 Self {
3428 storage,
3429 _marker: core::marker::PhantomData,
3430 }
3431 }
3432 pub fn into_storage(self) -> S {
3433 self.storage
3434 }
3435 pub fn into_view(self) -> CFrame<S, ST> {
3437 unsafe { CFrame::new_in_state(self.storage) }
3438 }
3439 pub fn as_view(&self) -> CFrame<S::Sliced<'_>, ST> {
3441 unsafe { CFrame::new_in_state(self.storage.slice(0, self.storage.len())) }
3442 }
3443
3444}
3445
3446impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for CFrame<S, ST> {
3447 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
3448 let view = self;
3449 core::result::Result::Ok((core::cmp::max((core::cmp::max((0) as i64, (4) as i64)
3450) as i64, ((if true { ( (4) as i64 + (({ let val = view.pdu_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
3451) as i64 )
3452 } else { 0 })
3453
3454) as i64)
3455) as usize)
3456 }
3457}
3458
3459impl<S: emboss_runtime::MutStorage> emboss_runtime::View for CFrameMut<S> {
3460 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
3461 let view = self.as_view();
3462 <CFrame<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
3463 }
3464}
3465
3466impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for CFrameWriter<S, ST> {
3467 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
3468 let view = self.as_view();
3469 <CFrame<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
3470 }
3471}
3472
3473impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for CFrame<S, emboss_runtime::UncheckedState> {
3474 type Completed = CFrame<S, emboss_runtime::CompleteState>;
3475 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
3476 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
3477 if self.storage.len() < required_size {
3478 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
3479 }
3480 core::result::Result::Ok(unsafe { CFrame::new_in_state(self.storage) })
3481 }
3482}
3483
3484impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for CFrameWriter<S, emboss_runtime::UncheckedState> {
3485 type Completed = CFrameWriter<S, emboss_runtime::CompleteState>;
3486 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
3487 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
3488 if self.storage.len() < required_size {
3489 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
3490 }
3491 core::result::Result::Ok(unsafe { CFrameWriter::new_in_state(self.storage) })
3492 }
3493}
3494
3495impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for CFrame<S, emboss_runtime::UncheckedState> {
3496 type Ok = CFrame<S, emboss_runtime::OkState>;
3497 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3498 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
3499 core::result::Result::Ok(unsafe { CFrame::new_in_state(completed.into_storage()) })
3500 }
3501}
3502
3503impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for CFrame<S, emboss_runtime::CompleteState> {
3504 type Ok = CFrame<S, emboss_runtime::OkState>;
3505 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3506 core::result::Result::Ok(unsafe { CFrame::new_in_state(self.into_storage()) })
3507 }
3508}
3509
3510impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for CFrame<S, emboss_runtime::OkState> {
3511 type Ok = CFrame<S, emboss_runtime::OkState>;
3512 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3513 core::result::Result::Ok(self)
3514 }
3515}
3516
3517impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for CFrameWriter<S, emboss_runtime::UncheckedState> {
3518 type Ok = CFrameWriter<S, emboss_runtime::OkState>;
3519 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3520 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
3521 core::result::Result::Ok(unsafe { CFrameWriter::new_in_state(completed.into_storage()) })
3522 }
3523}
3524
3525impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for CFrameWriter<S, emboss_runtime::CompleteState> {
3526 type Ok = CFrameWriter<S, emboss_runtime::OkState>;
3527 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3528 core::result::Result::Ok(unsafe { CFrameWriter::new_in_state(self.into_storage()) })
3529 }
3530}
3531
3532impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for CFrameWriter<S, emboss_runtime::OkState> {
3533 type Ok = CFrameWriter<S, emboss_runtime::OkState>;
3534 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3535 core::result::Result::Ok(self)
3536 }
3537}
3538
3539pub mod c_frame {
3540 pub type View<S, ST = emboss_runtime::UncheckedState> = super::CFrame<S, ST>;
3541 pub type ViewMut<S> = super::CFrameMut<S>;
3542 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::CFrameWriter<S, ST>;
3543
3544 pub const MIN_SIZE_IN_BYTES: usize = 4;
3545 pub const MAX_SIZE_IN_BYTES: usize = 65539;
3546}pub struct L2capSignalingCommandHeader<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
3547 storage: S,
3548 _marker: core::marker::PhantomData<ST>,
3549}
3550
3551impl<S: emboss_runtime::Storage> L2capSignalingCommandHeader<S, emboss_runtime::UncheckedState> {
3552 pub fn new(storage: S) -> Self {
3553 Self {
3554 storage,
3555 _marker: core::marker::PhantomData,
3556 }
3557 }
3558}
3559
3560impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capSignalingCommandHeader<S, ST> {
3561 fn clone(&self) -> Self {
3562 Self {
3563 storage: self.storage.clone(),
3564 _marker: core::marker::PhantomData,
3565 }
3566 }
3567}
3568
3569impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capSignalingCommandHeader<S, ST> {
3570 pub unsafe fn new_in_state(storage: S) -> Self {
3578 Self {
3579 storage,
3580 _marker: core::marker::PhantomData,
3581 }
3582 }
3583 pub fn into_storage(self) -> S {
3584 self.storage
3585 }
3586 pub fn code(&self) -> emboss_runtime::EnumView<L2capSignalingPacketCode, emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>> {
3587 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3588 let offset = (0) as usize;
3589 let len = (1) as usize;
3590 core::result::Result::Ok((offset, len))
3591 })().unwrap_or((usize::MAX, 0));
3592 let storage = self.storage.slice(offset, len);
3593 emboss_runtime::EnumView::new(emboss_runtime::UInt::new(storage))
3594 }
3595 pub fn identifier(&self) -> UInt<8, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
3596 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3597 let offset = (1) as usize;
3598 let len = (1) as usize;
3599 core::result::Result::Ok((offset, len))
3600 })().unwrap_or((usize::MAX, 0));
3601 let storage = self.storage.slice(offset, len);
3602 UInt::<8, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
3603 }
3604 pub fn data_length(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
3605 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3606 let offset = (2) as usize;
3607 let len = (2) as usize;
3608 core::result::Result::Ok((offset, len))
3609 })().unwrap_or((usize::MAX, 0));
3610 let storage = self.storage.slice(offset, len);
3611 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
3612 }
3613
3614}
3615
3616pub struct L2capSignalingCommandHeaderMut<S: emboss_runtime::MutStorage> {
3617 storage: S,
3618}
3619
3620impl<S: emboss_runtime::MutStorage> L2capSignalingCommandHeaderMut<S> {
3621 pub fn new(storage: S) -> Self {
3622 Self {
3623 storage,
3624 }
3625 }
3626 pub fn into_writer(self) -> L2capSignalingCommandHeaderWriter<S, emboss_runtime::UncheckedState> {
3627 L2capSignalingCommandHeaderWriter::new(self.storage)
3628 }
3629 pub fn as_view(&self) -> L2capSignalingCommandHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
3631 unsafe { L2capSignalingCommandHeader::new_in_state(self.storage.slice(0, self.storage.len())) }
3632 }
3633 pub fn code(&mut self) -> emboss_runtime::EnumViewMut<L2capSignalingPacketCode, emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>> {
3634 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3635 let offset = (0) as usize;
3636 let len = (1) as usize;
3637 core::result::Result::Ok((offset, len))
3638 })().unwrap_or((usize::MAX, 0));
3639 let storage = self.storage.slice_mut(offset, len);
3640 emboss_runtime::EnumViewMut::new(emboss_runtime::UInt::new(storage))
3641 }
3642 pub fn identifier(&mut self) -> UInt<8, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
3643 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3644 let offset = (1) as usize;
3645 let len = (1) as usize;
3646 core::result::Result::Ok((offset, len))
3647 })().unwrap_or((usize::MAX, 0));
3648 let storage = self.storage.slice_mut(offset, len);
3649 UInt::<8, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
3650 }
3651 pub fn data_length(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
3652 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3653 let offset = (2) as usize;
3654 let len = (2) as usize;
3655 core::result::Result::Ok((offset, len))
3656 })().unwrap_or((usize::MAX, 0));
3657 let storage = self.storage.slice_mut(offset, len);
3658 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
3659 }
3660
3661}
3662
3663impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capSignalingCommandHeaderMut<S> {
3664 type Writer = L2capSignalingCommandHeaderWriter<S, emboss_runtime::UncheckedState>;
3665 fn into_writer(self) -> Self::Writer {
3666 L2capSignalingCommandHeaderWriter::new(self.storage)
3667 }
3668}
3669
3670pub struct L2capSignalingCommandHeaderWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
3671 storage: S,
3672 _marker: core::marker::PhantomData<ST>,
3673}
3674
3675impl<S: emboss_runtime::MutStorage> L2capSignalingCommandHeaderWriter<S, emboss_runtime::UncheckedState> {
3676 pub fn new(storage: S) -> Self {
3677 Self {
3678 storage,
3679 _marker: core::marker::PhantomData,
3680 }
3681 }
3682}
3683
3684impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capSignalingCommandHeaderWriter<S, ST> {
3685 pub unsafe fn new_in_state(storage: S) -> Self {
3693 Self {
3694 storage,
3695 _marker: core::marker::PhantomData,
3696 }
3697 }
3698 pub fn into_storage(self) -> S {
3699 self.storage
3700 }
3701 pub fn into_view(self) -> L2capSignalingCommandHeader<S, ST> {
3703 unsafe { L2capSignalingCommandHeader::new_in_state(self.storage) }
3704 }
3705 pub fn as_view(&self) -> L2capSignalingCommandHeader<S::Sliced<'_>, ST> {
3707 unsafe { L2capSignalingCommandHeader::new_in_state(self.storage.slice(0, self.storage.len())) }
3708 }
3709 pub fn write_code(self, val: L2capSignalingPacketCode) -> L2capSignalingCommandHeaderWriter<S, ST::OnValidMutation> {
3710 let view = self.into_view();
3711 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3712 let offset = (0) as usize;
3713 let len = (1) as usize;
3714 core::result::Result::Ok((offset, len))
3715 })().expect("valid layout in complete state");
3716 let mut storage = view.into_storage();
3717 {
3718 let slice = storage.slice_mut(offset, len);
3719 let mut field_view = emboss_runtime::EnumViewMut::<L2capSignalingPacketCode, emboss_runtime::UInt<8, emboss_runtime::LittleEndian, _>>::new(emboss_runtime::UInt::new(slice));
3720 field_view.try_write(val).expect("valid write in complete state");
3721 }
3722 unsafe { L2capSignalingCommandHeaderWriter::new_in_state(storage) }
3723 }
3724 pub fn write_identifier(self, val: <emboss_runtime::SizeSelector<8> as emboss_runtime::SmallestUInt>::T) -> L2capSignalingCommandHeaderWriter<S, ST::OnValidMutation> {
3725 let view = self.into_view();
3726 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3727 let offset = (1) as usize;
3728 let len = (1) as usize;
3729 core::result::Result::Ok((offset, len))
3730 })().expect("valid layout in complete state");
3731 let mut storage = view.into_storage();
3732 {
3733 let slice = storage.slice_mut(offset, len);
3734 let mut field_view = emboss_runtime::UInt::<8, emboss_runtime::LittleEndian, _>::new(slice);
3735 field_view.try_write(val).expect("valid write in complete state");
3736 }
3737 unsafe { L2capSignalingCommandHeaderWriter::new_in_state(storage) }
3738 }
3739 pub fn write_data_length(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capSignalingCommandHeaderWriter<S, ST::OnValidMutation> {
3740 let view = self.into_view();
3741 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3742 let offset = (2) as usize;
3743 let len = (2) as usize;
3744 core::result::Result::Ok((offset, len))
3745 })().expect("valid layout in complete state");
3746 let mut storage = view.into_storage();
3747 {
3748 let slice = storage.slice_mut(offset, len);
3749 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
3750 field_view.try_write(val).expect("valid write in complete state");
3751 }
3752 unsafe { L2capSignalingCommandHeaderWriter::new_in_state(storage) }
3753 }
3754
3755}
3756
3757impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capSignalingCommandHeader<S, ST> {
3758 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
3759 let view = self;
3760 core::result::Result::Ok((4) as usize)
3761 }
3762}
3763
3764impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capSignalingCommandHeaderMut<S> {
3765 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
3766 let view = self.as_view();
3767 <L2capSignalingCommandHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
3768 }
3769}
3770
3771impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capSignalingCommandHeaderWriter<S, ST> {
3772 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
3773 let view = self.as_view();
3774 <L2capSignalingCommandHeader<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
3775 }
3776}
3777
3778impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capSignalingCommandHeader<S, emboss_runtime::UncheckedState> {
3779 type Completed = L2capSignalingCommandHeader<S, emboss_runtime::CompleteState>;
3780 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
3781 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
3782 if self.storage.len() < required_size {
3783 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
3784 }
3785 core::result::Result::Ok(unsafe { L2capSignalingCommandHeader::new_in_state(self.storage) })
3786 }
3787}
3788
3789impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capSignalingCommandHeaderWriter<S, emboss_runtime::UncheckedState> {
3790 type Completed = L2capSignalingCommandHeaderWriter<S, emboss_runtime::CompleteState>;
3791 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
3792 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
3793 if self.storage.len() < required_size {
3794 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
3795 }
3796 core::result::Result::Ok(unsafe { L2capSignalingCommandHeaderWriter::new_in_state(self.storage) })
3797 }
3798}
3799
3800impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capSignalingCommandHeader<S, emboss_runtime::UncheckedState> {
3801 type Ok = L2capSignalingCommandHeader<S, emboss_runtime::OkState>;
3802 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3803 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
3804 core::result::Result::Ok(unsafe { L2capSignalingCommandHeader::new_in_state(completed.into_storage()) })
3805 }
3806}
3807
3808impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capSignalingCommandHeader<S, emboss_runtime::CompleteState> {
3809 type Ok = L2capSignalingCommandHeader<S, emboss_runtime::OkState>;
3810 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3811 core::result::Result::Ok(unsafe { L2capSignalingCommandHeader::new_in_state(self.into_storage()) })
3812 }
3813}
3814
3815impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capSignalingCommandHeader<S, emboss_runtime::OkState> {
3816 type Ok = L2capSignalingCommandHeader<S, emboss_runtime::OkState>;
3817 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3818 core::result::Result::Ok(self)
3819 }
3820}
3821
3822impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capSignalingCommandHeaderWriter<S, emboss_runtime::UncheckedState> {
3823 type Ok = L2capSignalingCommandHeaderWriter<S, emboss_runtime::OkState>;
3824 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3825 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
3826 core::result::Result::Ok(unsafe { L2capSignalingCommandHeaderWriter::new_in_state(completed.into_storage()) })
3827 }
3828}
3829
3830impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capSignalingCommandHeaderWriter<S, emboss_runtime::CompleteState> {
3831 type Ok = L2capSignalingCommandHeaderWriter<S, emboss_runtime::OkState>;
3832 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3833 core::result::Result::Ok(unsafe { L2capSignalingCommandHeaderWriter::new_in_state(self.into_storage()) })
3834 }
3835}
3836
3837impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capSignalingCommandHeaderWriter<S, emboss_runtime::OkState> {
3838 type Ok = L2capSignalingCommandHeaderWriter<S, emboss_runtime::OkState>;
3839 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
3840 core::result::Result::Ok(self)
3841 }
3842}
3843
3844pub mod l2cap_signaling_command_header {
3845 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capSignalingCommandHeader<S, ST>;
3846 pub type ViewMut<S> = super::L2capSignalingCommandHeaderMut<S>;
3847 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capSignalingCommandHeaderWriter<S, ST>;
3848
3849 pub const MIN_SIZE_IN_BYTES: usize = 4;
3850 pub const MAX_SIZE_IN_BYTES: usize = 4;
3851 pub const SIZE_IN_BYTES: usize = 4;
3852}pub struct L2capSignalingCommand_Payload_ArrayView<S: emboss_runtime::Storage> {
3853 storage: S,
3854 element_count: usize,
3855}
3856
3857impl<S: emboss_runtime::Storage + core::clone::Clone> core::clone::Clone for L2capSignalingCommand_Payload_ArrayView<S> {
3858 fn clone(&self) -> Self {
3859 Self {
3860 storage: self.storage.clone(),
3861 element_count: self.element_count,
3862 }
3863 }
3864}
3865
3866impl<S: emboss_runtime::Storage> L2capSignalingCommand_Payload_ArrayView<S> {
3867 pub const ELEMENT_SIZE_BYTES: usize = 1;
3868 pub fn new(storage: S, element_count: usize) -> Self {
3869 Self { storage, element_count }
3870 }
3871 pub fn element_count(&self) -> usize {
3872 self.element_count
3873 }
3874 pub fn get(&self, index: usize) -> core::result::Result<emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::Sliced<'_>>
3875, emboss_runtime::Error> {
3876 if index >= self.element_count {
3877 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
3878 }
3879 let offset = index * Self::ELEMENT_SIZE_BYTES;
3880 let storage = self.storage.slice(offset, Self::ELEMENT_SIZE_BYTES);
3881 core::result::Result::Ok(emboss_runtime::UInt::new(storage)
3882)
3883 }
3884}
3885
3886pub struct L2capSignalingCommand_Payload_ArrayViewMut<S: emboss_runtime::MutStorage> {
3887 storage: S,
3888 element_count: usize,
3889}
3890
3891impl<S: emboss_runtime::MutStorage> L2capSignalingCommand_Payload_ArrayViewMut<S> {
3892 pub const ELEMENT_SIZE_BYTES: usize = 1;
3893 pub fn new(storage: S, element_count: usize) -> Self {
3894 Self { storage, element_count }
3895 }
3896 pub fn element_count(&self) -> usize {
3897 self.element_count
3898 }
3899 pub fn get_mut(&mut self, index: usize) -> core::result::Result<emboss_runtime::UInt<8, emboss_runtime::LittleEndian, S::SlicedMut<'_>>
3900, emboss_runtime::Error> {
3901 if index >= self.element_count {
3902 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
3903 }
3904 let offset = index * Self::ELEMENT_SIZE_BYTES;
3905 let storage = self.storage.slice_mut(offset, Self::ELEMENT_SIZE_BYTES);
3906 core::result::Result::Ok(emboss_runtime::UInt::new(storage)
3907)
3908 }
3909}
3910pub struct L2capSignalingCommand<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
3911 storage: S,
3912 _marker: core::marker::PhantomData<ST>,
3913}
3914
3915impl<S: emboss_runtime::Storage> L2capSignalingCommand<S, emboss_runtime::UncheckedState> {
3916 pub fn new(storage: S) -> Self {
3917 Self {
3918 storage,
3919 _marker: core::marker::PhantomData,
3920 }
3921 }
3922}
3923
3924impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capSignalingCommand<S, ST> {
3925 fn clone(&self) -> Self {
3926 Self {
3927 storage: self.storage.clone(),
3928 _marker: core::marker::PhantomData,
3929 }
3930 }
3931}
3932
3933impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capSignalingCommand<S, ST> {
3934 pub unsafe fn new_in_state(storage: S) -> Self {
3942 Self {
3943 storage,
3944 _marker: core::marker::PhantomData,
3945 }
3946 }
3947 pub fn into_storage(self) -> S {
3948 self.storage
3949 }
3950 pub fn command_header(&self) -> L2capSignalingCommandHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
3951 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
3952 let offset = (0) as usize;
3953 let len = (4) as usize;
3954 core::result::Result::Ok((offset, len))
3955 })().unwrap_or((usize::MAX, 0));
3956 let storage = self.storage.slice(offset, len);
3957 unsafe { L2capSignalingCommandHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
3958 }
3959 pub fn data_length(&self) -> emboss_runtime::VirtualField<u64> {
3960 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
3961 core::result::Result::Ok( (({ let val = self.command_header().data_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
3962) as u64 )
3963 })();
3964 emboss_runtime::VirtualField::new(value)
3965 }
3966 pub fn payload(&self) -> core::result::Result<L2capSignalingCommand_Payload_ArrayView<S::Sliced<'_>>, emboss_runtime::Error> {
3967 let offset_res = (|| -> core::result::Result<(usize, usize, usize), emboss_runtime::Error> {
3968 let offset = (4) as usize;
3969 let len = (({ let val = self.data_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
3970) as usize;
3971 let element_count = (len / (1)) as usize;
3972 core::result::Result::Ok((offset, len, element_count))
3973 })();
3974 match offset_res {
3975 core::result::Result::Ok((offset, len, element_count)) => {
3976 if len > 0 {
3977 let end = offset.checked_add(len).ok_or(emboss_runtime::Error::OutOfBounds)?;
3978 self.storage.try_read_byte(end - 1)?;
3979 }
3980 let storage = self.storage.slice(offset, len);
3981 core::result::Result::Ok(L2capSignalingCommand_Payload_ArrayView::new(storage, element_count))
3982 },
3983 core::result::Result::Err(e) => core::result::Result::Err(e),
3984 }
3985 }
3986
3987}
3988
3989pub struct L2capSignalingCommandMut<S: emboss_runtime::MutStorage> {
3990 storage: S,
3991}
3992
3993impl<S: emboss_runtime::MutStorage> L2capSignalingCommandMut<S> {
3994 pub fn new(storage: S) -> Self {
3995 Self {
3996 storage,
3997 }
3998 }
3999 pub fn into_writer(self) -> L2capSignalingCommandWriter<S, emboss_runtime::UncheckedState> {
4000 L2capSignalingCommandWriter::new(self.storage)
4001 }
4002 pub fn as_view(&self) -> L2capSignalingCommand<S::Sliced<'_>, emboss_runtime::UncheckedState> {
4004 unsafe { L2capSignalingCommand::new_in_state(self.storage.slice(0, self.storage.len())) }
4005 }
4006 pub fn command_header(&mut self) -> L2capSignalingCommandHeaderMut<S::SlicedMut<'_>> {
4007 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4008 let offset = (0) as usize;
4009 let len = (4) as usize;
4010 core::result::Result::Ok((offset, len))
4011 })().unwrap_or((usize::MAX, 0));
4012 let storage = self.storage.slice_mut(offset, len);
4013 L2capSignalingCommandHeaderMut::<S::SlicedMut<'_>>::new(storage)
4014 }
4015 pub fn data_length(&mut self) -> emboss_runtime::VirtualField<u64> {
4016 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
4017 core::result::Result::Ok( (({ let val = self.command_header().data_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
4018) as u64 )
4019 })();
4020 emboss_runtime::VirtualField::new(value)
4021 }
4022 pub fn payload_mut(&mut self) -> core::result::Result<L2capSignalingCommand_Payload_ArrayViewMut<S::SlicedMut<'_>>, emboss_runtime::Error> {
4023 let offset_res = (|| -> core::result::Result<(usize, usize, usize), emboss_runtime::Error> {
4024 let offset = (4) as usize;
4025 let len = (({ let val = self.data_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
4026) as usize;
4027 let element_count = (len / (1)) as usize;
4028 core::result::Result::Ok((offset, len, element_count))
4029 })();
4030 match offset_res {
4031 core::result::Result::Ok((offset, len, element_count)) => {
4032 if len > 0 {
4033 let end = offset.checked_add(len).ok_or(emboss_runtime::Error::OutOfBounds)?;
4034 self.storage.try_read_byte(end - 1)?;
4035 }
4036 let storage = self.storage.slice_mut(offset, len);
4037 core::result::Result::Ok(L2capSignalingCommand_Payload_ArrayViewMut::new(storage, element_count))
4038 },
4039 core::result::Result::Err(e) => core::result::Result::Err(e),
4040 }
4041 }
4042
4043}
4044
4045impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capSignalingCommandMut<S> {
4046 type Writer = L2capSignalingCommandWriter<S, emboss_runtime::UncheckedState>;
4047 fn into_writer(self) -> Self::Writer {
4048 L2capSignalingCommandWriter::new(self.storage)
4049 }
4050}
4051
4052pub struct L2capSignalingCommandWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
4053 storage: S,
4054 _marker: core::marker::PhantomData<ST>,
4055}
4056
4057impl<S: emboss_runtime::MutStorage> L2capSignalingCommandWriter<S, emboss_runtime::UncheckedState> {
4058 pub fn new(storage: S) -> Self {
4059 Self {
4060 storage,
4061 _marker: core::marker::PhantomData,
4062 }
4063 }
4064}
4065
4066impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capSignalingCommandWriter<S, ST> {
4067 pub unsafe fn new_in_state(storage: S) -> Self {
4075 Self {
4076 storage,
4077 _marker: core::marker::PhantomData,
4078 }
4079 }
4080 pub fn into_storage(self) -> S {
4081 self.storage
4082 }
4083 pub fn into_view(self) -> L2capSignalingCommand<S, ST> {
4085 unsafe { L2capSignalingCommand::new_in_state(self.storage) }
4086 }
4087 pub fn as_view(&self) -> L2capSignalingCommand<S::Sliced<'_>, ST> {
4089 unsafe { L2capSignalingCommand::new_in_state(self.storage.slice(0, self.storage.len())) }
4090 }
4091
4092}
4093
4094impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capSignalingCommand<S, ST> {
4095 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
4096 let view = self;
4097 core::result::Result::Ok((core::cmp::max((core::cmp::max((0) as i64, (4) as i64)
4098) as i64, ((if true { ( (4) as i64 + (({ let val = view.data_length().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
4099) as i64 )
4100 } else { 0 })
4101
4102) as i64)
4103) as usize)
4104 }
4105}
4106
4107impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capSignalingCommandMut<S> {
4108 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
4109 let view = self.as_view();
4110 <L2capSignalingCommand<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
4111 }
4112}
4113
4114impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capSignalingCommandWriter<S, ST> {
4115 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
4116 let view = self.as_view();
4117 <L2capSignalingCommand<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
4118 }
4119}
4120
4121impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capSignalingCommand<S, emboss_runtime::UncheckedState> {
4122 type Completed = L2capSignalingCommand<S, emboss_runtime::CompleteState>;
4123 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
4124 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
4125 if self.storage.len() < required_size {
4126 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
4127 }
4128 core::result::Result::Ok(unsafe { L2capSignalingCommand::new_in_state(self.storage) })
4129 }
4130}
4131
4132impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capSignalingCommandWriter<S, emboss_runtime::UncheckedState> {
4133 type Completed = L2capSignalingCommandWriter<S, emboss_runtime::CompleteState>;
4134 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
4135 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
4136 if self.storage.len() < required_size {
4137 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
4138 }
4139 core::result::Result::Ok(unsafe { L2capSignalingCommandWriter::new_in_state(self.storage) })
4140 }
4141}
4142
4143impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capSignalingCommand<S, emboss_runtime::UncheckedState> {
4144 type Ok = L2capSignalingCommand<S, emboss_runtime::OkState>;
4145 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4146 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
4147 core::result::Result::Ok(unsafe { L2capSignalingCommand::new_in_state(completed.into_storage()) })
4148 }
4149}
4150
4151impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capSignalingCommand<S, emboss_runtime::CompleteState> {
4152 type Ok = L2capSignalingCommand<S, emboss_runtime::OkState>;
4153 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4154 core::result::Result::Ok(unsafe { L2capSignalingCommand::new_in_state(self.into_storage()) })
4155 }
4156}
4157
4158impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capSignalingCommand<S, emboss_runtime::OkState> {
4159 type Ok = L2capSignalingCommand<S, emboss_runtime::OkState>;
4160 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4161 core::result::Result::Ok(self)
4162 }
4163}
4164
4165impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capSignalingCommandWriter<S, emboss_runtime::UncheckedState> {
4166 type Ok = L2capSignalingCommandWriter<S, emboss_runtime::OkState>;
4167 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4168 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
4169 core::result::Result::Ok(unsafe { L2capSignalingCommandWriter::new_in_state(completed.into_storage()) })
4170 }
4171}
4172
4173impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capSignalingCommandWriter<S, emboss_runtime::CompleteState> {
4174 type Ok = L2capSignalingCommandWriter<S, emboss_runtime::OkState>;
4175 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4176 core::result::Result::Ok(unsafe { L2capSignalingCommandWriter::new_in_state(self.into_storage()) })
4177 }
4178}
4179
4180impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capSignalingCommandWriter<S, emboss_runtime::OkState> {
4181 type Ok = L2capSignalingCommandWriter<S, emboss_runtime::OkState>;
4182 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4183 core::result::Result::Ok(self)
4184 }
4185}
4186
4187pub mod l2cap_signaling_command {
4188 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capSignalingCommand<S, ST>;
4189 pub type ViewMut<S> = super::L2capSignalingCommandMut<S>;
4190 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capSignalingCommandWriter<S, ST>;
4191
4192 pub const MIN_SIZE_IN_BYTES: usize = 4;
4193 pub const MAX_SIZE_IN_BYTES: usize = 65539;
4194}pub struct L2capCommandRejectRsp<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
4195 storage: S,
4196 _marker: core::marker::PhantomData<ST>,
4197}
4198
4199impl<S: emboss_runtime::Storage> L2capCommandRejectRsp<S, emboss_runtime::UncheckedState> {
4200 pub fn new(storage: S) -> Self {
4201 Self {
4202 storage,
4203 _marker: core::marker::PhantomData,
4204 }
4205 }
4206}
4207
4208impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capCommandRejectRsp<S, ST> {
4209 fn clone(&self) -> Self {
4210 Self {
4211 storage: self.storage.clone(),
4212 _marker: core::marker::PhantomData,
4213 }
4214 }
4215}
4216
4217impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capCommandRejectRsp<S, ST> {
4218 pub unsafe fn new_in_state(storage: S) -> Self {
4226 Self {
4227 storage,
4228 _marker: core::marker::PhantomData,
4229 }
4230 }
4231 pub fn into_storage(self) -> S {
4232 self.storage
4233 }
4234 pub fn command_header(&self) -> L2capSignalingCommandHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
4235 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4236 let offset = (0) as usize;
4237 let len = (4) as usize;
4238 core::result::Result::Ok((offset, len))
4239 })().unwrap_or((usize::MAX, 0));
4240 let storage = self.storage.slice(offset, len);
4241 unsafe { L2capSignalingCommandHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
4242 }
4243 pub fn reason(&self) -> emboss_runtime::EnumView<L2capCommandRejectReasonCode, emboss_runtime::UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>> {
4244 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4245 let offset = (4) as usize;
4246 let len = (2) as usize;
4247 core::result::Result::Ok((offset, len))
4248 })().unwrap_or((usize::MAX, 0));
4249 let storage = self.storage.slice(offset, len);
4250 emboss_runtime::EnumView::new(emboss_runtime::UInt::new(storage))
4251 }
4252
4253}
4254
4255pub struct L2capCommandRejectRspMut<S: emboss_runtime::MutStorage> {
4256 storage: S,
4257}
4258
4259impl<S: emboss_runtime::MutStorage> L2capCommandRejectRspMut<S> {
4260 pub fn new(storage: S) -> Self {
4261 Self {
4262 storage,
4263 }
4264 }
4265 pub fn into_writer(self) -> L2capCommandRejectRspWriter<S, emboss_runtime::UncheckedState> {
4266 L2capCommandRejectRspWriter::new(self.storage)
4267 }
4268 pub fn as_view(&self) -> L2capCommandRejectRsp<S::Sliced<'_>, emboss_runtime::UncheckedState> {
4270 unsafe { L2capCommandRejectRsp::new_in_state(self.storage.slice(0, self.storage.len())) }
4271 }
4272 pub fn command_header(&mut self) -> L2capSignalingCommandHeaderMut<S::SlicedMut<'_>> {
4273 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4274 let offset = (0) as usize;
4275 let len = (4) as usize;
4276 core::result::Result::Ok((offset, len))
4277 })().unwrap_or((usize::MAX, 0));
4278 let storage = self.storage.slice_mut(offset, len);
4279 L2capSignalingCommandHeaderMut::<S::SlicedMut<'_>>::new(storage)
4280 }
4281 pub fn reason(&mut self) -> emboss_runtime::EnumViewMut<L2capCommandRejectReasonCode, emboss_runtime::UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>> {
4282 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4283 let offset = (4) as usize;
4284 let len = (2) as usize;
4285 core::result::Result::Ok((offset, len))
4286 })().unwrap_or((usize::MAX, 0));
4287 let storage = self.storage.slice_mut(offset, len);
4288 emboss_runtime::EnumViewMut::new(emboss_runtime::UInt::new(storage))
4289 }
4290
4291}
4292
4293impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capCommandRejectRspMut<S> {
4294 type Writer = L2capCommandRejectRspWriter<S, emboss_runtime::UncheckedState>;
4295 fn into_writer(self) -> Self::Writer {
4296 L2capCommandRejectRspWriter::new(self.storage)
4297 }
4298}
4299
4300pub struct L2capCommandRejectRspWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
4301 storage: S,
4302 _marker: core::marker::PhantomData<ST>,
4303}
4304
4305impl<S: emboss_runtime::MutStorage> L2capCommandRejectRspWriter<S, emboss_runtime::UncheckedState> {
4306 pub fn new(storage: S) -> Self {
4307 Self {
4308 storage,
4309 _marker: core::marker::PhantomData,
4310 }
4311 }
4312}
4313
4314impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capCommandRejectRspWriter<S, ST> {
4315 pub unsafe fn new_in_state(storage: S) -> Self {
4323 Self {
4324 storage,
4325 _marker: core::marker::PhantomData,
4326 }
4327 }
4328 pub fn into_storage(self) -> S {
4329 self.storage
4330 }
4331 pub fn into_view(self) -> L2capCommandRejectRsp<S, ST> {
4333 unsafe { L2capCommandRejectRsp::new_in_state(self.storage) }
4334 }
4335 pub fn as_view(&self) -> L2capCommandRejectRsp<S::Sliced<'_>, ST> {
4337 unsafe { L2capCommandRejectRsp::new_in_state(self.storage.slice(0, self.storage.len())) }
4338 }
4339 pub fn write_reason(self, val: L2capCommandRejectReasonCode) -> L2capCommandRejectRspWriter<S, ST::OnLayoutMutation> {
4340 let view = self.into_view();
4341 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4342 let offset = (4) as usize;
4343 let len = (2) as usize;
4344 core::result::Result::Ok((offset, len))
4345 })().expect("valid layout in complete state");
4346 let mut storage = view.into_storage();
4347 {
4348 let slice = storage.slice_mut(offset, len);
4349 let mut field_view = emboss_runtime::EnumViewMut::<L2capCommandRejectReasonCode, emboss_runtime::UInt<16, emboss_runtime::LittleEndian, _>>::new(emboss_runtime::UInt::new(slice));
4350 field_view.try_write(val).expect("valid write in complete state");
4351 }
4352 unsafe { L2capCommandRejectRspWriter::new_in_state(storage) }
4353 }
4354
4355}
4356
4357impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capCommandRejectRsp<S, ST> {
4358 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
4359 let view = self;
4360 core::result::Result::Ok((core::cmp::max((core::cmp::max((core::cmp::max((core::cmp::max((core::cmp::max((0) as i64, (4) as i64)
4361) as i64, (6) as i64)
4362) as i64, ((if emboss_runtime::SafeCmp::safe_eq(&(({ let val = view.reason().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
4363), (1) as u64)
4364 { 8 } else { 0 })
4365
4366) as i64)
4367) as i64, ((if emboss_runtime::SafeCmp::safe_eq(&(({ let val = view.reason().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
4368), (2) as u64)
4369 { 8 } else { 0 })
4370
4371) as i64)
4372) as i64, ((if emboss_runtime::SafeCmp::safe_eq(&(({ let val = view.reason().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
4373), (2) as u64)
4374 { 10 } else { 0 })
4375
4376) as i64)
4377) as usize)
4378 }
4379}
4380
4381impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capCommandRejectRspMut<S> {
4382 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
4383 let view = self.as_view();
4384 <L2capCommandRejectRsp<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
4385 }
4386}
4387
4388impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capCommandRejectRspWriter<S, ST> {
4389 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
4390 let view = self.as_view();
4391 <L2capCommandRejectRsp<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
4392 }
4393}
4394
4395impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capCommandRejectRsp<S, emboss_runtime::UncheckedState> {
4396 type Completed = L2capCommandRejectRsp<S, emboss_runtime::CompleteState>;
4397 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
4398 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
4399 if self.storage.len() < required_size {
4400 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
4401 }
4402 core::result::Result::Ok(unsafe { L2capCommandRejectRsp::new_in_state(self.storage) })
4403 }
4404}
4405
4406impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capCommandRejectRspWriter<S, emboss_runtime::UncheckedState> {
4407 type Completed = L2capCommandRejectRspWriter<S, emboss_runtime::CompleteState>;
4408 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
4409 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
4410 if self.storage.len() < required_size {
4411 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
4412 }
4413 core::result::Result::Ok(unsafe { L2capCommandRejectRspWriter::new_in_state(self.storage) })
4414 }
4415}
4416
4417impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capCommandRejectRsp<S, emboss_runtime::UncheckedState> {
4418 type Ok = L2capCommandRejectRsp<S, emboss_runtime::OkState>;
4419 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4420 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
4421 core::result::Result::Ok(unsafe { L2capCommandRejectRsp::new_in_state(completed.into_storage()) })
4422 }
4423}
4424
4425impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capCommandRejectRsp<S, emboss_runtime::CompleteState> {
4426 type Ok = L2capCommandRejectRsp<S, emboss_runtime::OkState>;
4427 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4428 core::result::Result::Ok(unsafe { L2capCommandRejectRsp::new_in_state(self.into_storage()) })
4429 }
4430}
4431
4432impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capCommandRejectRsp<S, emboss_runtime::OkState> {
4433 type Ok = L2capCommandRejectRsp<S, emboss_runtime::OkState>;
4434 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4435 core::result::Result::Ok(self)
4436 }
4437}
4438
4439impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capCommandRejectRspWriter<S, emboss_runtime::UncheckedState> {
4440 type Ok = L2capCommandRejectRspWriter<S, emboss_runtime::OkState>;
4441 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4442 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
4443 core::result::Result::Ok(unsafe { L2capCommandRejectRspWriter::new_in_state(completed.into_storage()) })
4444 }
4445}
4446
4447impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capCommandRejectRspWriter<S, emboss_runtime::CompleteState> {
4448 type Ok = L2capCommandRejectRspWriter<S, emboss_runtime::OkState>;
4449 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4450 core::result::Result::Ok(unsafe { L2capCommandRejectRspWriter::new_in_state(self.into_storage()) })
4451 }
4452}
4453
4454impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capCommandRejectRspWriter<S, emboss_runtime::OkState> {
4455 type Ok = L2capCommandRejectRspWriter<S, emboss_runtime::OkState>;
4456 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4457 core::result::Result::Ok(self)
4458 }
4459}
4460
4461pub mod l2cap_command_reject_rsp {
4462 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capCommandRejectRsp<S, ST>;
4463 pub type ViewMut<S> = super::L2capCommandRejectRspMut<S>;
4464 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capCommandRejectRspWriter<S, ST>;
4465
4466 pub const MIN_SIZE_IN_BYTES: usize = 6;
4467 pub const MAX_SIZE_IN_BYTES: usize = 10;
4468}pub struct L2capConnectionReq<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
4469 storage: S,
4470 _marker: core::marker::PhantomData<ST>,
4471}
4472
4473impl<S: emboss_runtime::Storage> L2capConnectionReq<S, emboss_runtime::UncheckedState> {
4474 pub fn new(storage: S) -> Self {
4475 Self {
4476 storage,
4477 _marker: core::marker::PhantomData,
4478 }
4479 }
4480}
4481
4482impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capConnectionReq<S, ST> {
4483 fn clone(&self) -> Self {
4484 Self {
4485 storage: self.storage.clone(),
4486 _marker: core::marker::PhantomData,
4487 }
4488 }
4489}
4490
4491impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capConnectionReq<S, ST> {
4492 pub unsafe fn new_in_state(storage: S) -> Self {
4500 Self {
4501 storage,
4502 _marker: core::marker::PhantomData,
4503 }
4504 }
4505 pub fn into_storage(self) -> S {
4506 self.storage
4507 }
4508 pub fn command_header(&self) -> L2capSignalingCommandHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
4509 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4510 let offset = (0) as usize;
4511 let len = (4) as usize;
4512 core::result::Result::Ok((offset, len))
4513 })().unwrap_or((usize::MAX, 0));
4514 let storage = self.storage.slice(offset, len);
4515 unsafe { L2capSignalingCommandHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
4516 }
4517 pub fn psm(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
4518 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4519 let offset = (4) as usize;
4520 let len = (2) as usize;
4521 core::result::Result::Ok((offset, len))
4522 })().unwrap_or((usize::MAX, 0));
4523 let storage = self.storage.slice(offset, len);
4524 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
4525 }
4526 pub fn source_cid(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
4527 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4528 let offset = (6) as usize;
4529 let len = (2) as usize;
4530 core::result::Result::Ok((offset, len))
4531 })().unwrap_or((usize::MAX, 0));
4532 let storage = self.storage.slice(offset, len);
4533 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
4534 }
4535
4536}
4537
4538pub struct L2capConnectionReqMut<S: emboss_runtime::MutStorage> {
4539 storage: S,
4540}
4541
4542impl<S: emboss_runtime::MutStorage> L2capConnectionReqMut<S> {
4543 pub fn new(storage: S) -> Self {
4544 Self {
4545 storage,
4546 }
4547 }
4548 pub fn into_writer(self) -> L2capConnectionReqWriter<S, emboss_runtime::UncheckedState> {
4549 L2capConnectionReqWriter::new(self.storage)
4550 }
4551 pub fn as_view(&self) -> L2capConnectionReq<S::Sliced<'_>, emboss_runtime::UncheckedState> {
4553 unsafe { L2capConnectionReq::new_in_state(self.storage.slice(0, self.storage.len())) }
4554 }
4555 pub fn command_header(&mut self) -> L2capSignalingCommandHeaderMut<S::SlicedMut<'_>> {
4556 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4557 let offset = (0) as usize;
4558 let len = (4) as usize;
4559 core::result::Result::Ok((offset, len))
4560 })().unwrap_or((usize::MAX, 0));
4561 let storage = self.storage.slice_mut(offset, len);
4562 L2capSignalingCommandHeaderMut::<S::SlicedMut<'_>>::new(storage)
4563 }
4564 pub fn psm(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
4565 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4566 let offset = (4) as usize;
4567 let len = (2) as usize;
4568 core::result::Result::Ok((offset, len))
4569 })().unwrap_or((usize::MAX, 0));
4570 let storage = self.storage.slice_mut(offset, len);
4571 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
4572 }
4573 pub fn source_cid(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
4574 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4575 let offset = (6) as usize;
4576 let len = (2) as usize;
4577 core::result::Result::Ok((offset, len))
4578 })().unwrap_or((usize::MAX, 0));
4579 let storage = self.storage.slice_mut(offset, len);
4580 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
4581 }
4582
4583}
4584
4585impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capConnectionReqMut<S> {
4586 type Writer = L2capConnectionReqWriter<S, emboss_runtime::UncheckedState>;
4587 fn into_writer(self) -> Self::Writer {
4588 L2capConnectionReqWriter::new(self.storage)
4589 }
4590}
4591
4592pub struct L2capConnectionReqWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
4593 storage: S,
4594 _marker: core::marker::PhantomData<ST>,
4595}
4596
4597impl<S: emboss_runtime::MutStorage> L2capConnectionReqWriter<S, emboss_runtime::UncheckedState> {
4598 pub fn new(storage: S) -> Self {
4599 Self {
4600 storage,
4601 _marker: core::marker::PhantomData,
4602 }
4603 }
4604}
4605
4606impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capConnectionReqWriter<S, ST> {
4607 pub unsafe fn new_in_state(storage: S) -> Self {
4615 Self {
4616 storage,
4617 _marker: core::marker::PhantomData,
4618 }
4619 }
4620 pub fn into_storage(self) -> S {
4621 self.storage
4622 }
4623 pub fn into_view(self) -> L2capConnectionReq<S, ST> {
4625 unsafe { L2capConnectionReq::new_in_state(self.storage) }
4626 }
4627 pub fn as_view(&self) -> L2capConnectionReq<S::Sliced<'_>, ST> {
4629 unsafe { L2capConnectionReq::new_in_state(self.storage.slice(0, self.storage.len())) }
4630 }
4631 pub fn write_psm(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capConnectionReqWriter<S, ST::OnValidMutation> {
4632 let view = self.into_view();
4633 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4634 let offset = (4) as usize;
4635 let len = (2) as usize;
4636 core::result::Result::Ok((offset, len))
4637 })().expect("valid layout in complete state");
4638 let mut storage = view.into_storage();
4639 {
4640 let slice = storage.slice_mut(offset, len);
4641 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
4642 field_view.try_write(val).expect("valid write in complete state");
4643 }
4644 unsafe { L2capConnectionReqWriter::new_in_state(storage) }
4645 }
4646 pub fn write_source_cid(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capConnectionReqWriter<S, ST::OnValidMutation> {
4647 let view = self.into_view();
4648 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4649 let offset = (6) as usize;
4650 let len = (2) as usize;
4651 core::result::Result::Ok((offset, len))
4652 })().expect("valid layout in complete state");
4653 let mut storage = view.into_storage();
4654 {
4655 let slice = storage.slice_mut(offset, len);
4656 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
4657 field_view.try_write(val).expect("valid write in complete state");
4658 }
4659 unsafe { L2capConnectionReqWriter::new_in_state(storage) }
4660 }
4661
4662}
4663
4664impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capConnectionReq<S, ST> {
4665 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
4666 let view = self;
4667 core::result::Result::Ok((8) as usize)
4668 }
4669}
4670
4671impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capConnectionReqMut<S> {
4672 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
4673 let view = self.as_view();
4674 <L2capConnectionReq<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
4675 }
4676}
4677
4678impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capConnectionReqWriter<S, ST> {
4679 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
4680 let view = self.as_view();
4681 <L2capConnectionReq<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
4682 }
4683}
4684
4685impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capConnectionReq<S, emboss_runtime::UncheckedState> {
4686 type Completed = L2capConnectionReq<S, emboss_runtime::CompleteState>;
4687 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
4688 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
4689 if self.storage.len() < required_size {
4690 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
4691 }
4692 core::result::Result::Ok(unsafe { L2capConnectionReq::new_in_state(self.storage) })
4693 }
4694}
4695
4696impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capConnectionReqWriter<S, emboss_runtime::UncheckedState> {
4697 type Completed = L2capConnectionReqWriter<S, emboss_runtime::CompleteState>;
4698 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
4699 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
4700 if self.storage.len() < required_size {
4701 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
4702 }
4703 core::result::Result::Ok(unsafe { L2capConnectionReqWriter::new_in_state(self.storage) })
4704 }
4705}
4706
4707impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConnectionReq<S, emboss_runtime::UncheckedState> {
4708 type Ok = L2capConnectionReq<S, emboss_runtime::OkState>;
4709 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4710 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
4711 core::result::Result::Ok(unsafe { L2capConnectionReq::new_in_state(completed.into_storage()) })
4712 }
4713}
4714
4715impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConnectionReq<S, emboss_runtime::CompleteState> {
4716 type Ok = L2capConnectionReq<S, emboss_runtime::OkState>;
4717 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4718 core::result::Result::Ok(unsafe { L2capConnectionReq::new_in_state(self.into_storage()) })
4719 }
4720}
4721
4722impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConnectionReq<S, emboss_runtime::OkState> {
4723 type Ok = L2capConnectionReq<S, emboss_runtime::OkState>;
4724 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4725 core::result::Result::Ok(self)
4726 }
4727}
4728
4729impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConnectionReqWriter<S, emboss_runtime::UncheckedState> {
4730 type Ok = L2capConnectionReqWriter<S, emboss_runtime::OkState>;
4731 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4732 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
4733 core::result::Result::Ok(unsafe { L2capConnectionReqWriter::new_in_state(completed.into_storage()) })
4734 }
4735}
4736
4737impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConnectionReqWriter<S, emboss_runtime::CompleteState> {
4738 type Ok = L2capConnectionReqWriter<S, emboss_runtime::OkState>;
4739 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4740 core::result::Result::Ok(unsafe { L2capConnectionReqWriter::new_in_state(self.into_storage()) })
4741 }
4742}
4743
4744impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConnectionReqWriter<S, emboss_runtime::OkState> {
4745 type Ok = L2capConnectionReqWriter<S, emboss_runtime::OkState>;
4746 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
4747 core::result::Result::Ok(self)
4748 }
4749}
4750
4751pub mod l2cap_connection_req {
4752 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capConnectionReq<S, ST>;
4753 pub type ViewMut<S> = super::L2capConnectionReqMut<S>;
4754 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capConnectionReqWriter<S, ST>;
4755
4756 pub const MIN_SIZE_IN_BYTES: usize = 8;
4757 pub const MAX_SIZE_IN_BYTES: usize = 8;
4758 pub const SIZE_IN_BYTES: usize = 8;
4759}#[derive(Copy, Clone, Debug, Eq, PartialEq)]
4760#[repr(u64)]
4761pub enum L2capConnectionRspResultCode {
4762 SUCCESSFUL = 0,
4763 PENDING = 1,
4764 PSM_NOT_SUPPORTED = 2,
4765 SECURITY_BLOCK = 3,
4766 NO_RESOURCES_AVAILABLE = 4,
4767 INVALID_SOURCE_CID = 5,
4768 SOURCE_CID_ALREADY_ALLOCATED = 6,
4769
4770}
4771
4772impl core::convert::From<L2capConnectionRspResultCode> for u8 { fn from(val: L2capConnectionRspResultCode) -> Self { val as u8 } }
4773impl core::convert::From<L2capConnectionRspResultCode> for u16 { fn from(val: L2capConnectionRspResultCode) -> Self { val as u16 } }
4774impl core::convert::From<L2capConnectionRspResultCode> for u32 { fn from(val: L2capConnectionRspResultCode) -> Self { val as u32 } }
4775impl core::convert::From<L2capConnectionRspResultCode> for u64 { fn from(val: L2capConnectionRspResultCode) -> Self { val as u64 } }
4776impl core::convert::From<L2capConnectionRspResultCode> for i8 { fn from(val: L2capConnectionRspResultCode) -> Self { val as i8 } }
4777impl core::convert::From<L2capConnectionRspResultCode> for i16 { fn from(val: L2capConnectionRspResultCode) -> Self { val as i16 } }
4778impl core::convert::From<L2capConnectionRspResultCode> for i32 { fn from(val: L2capConnectionRspResultCode) -> Self { val as i32 } }
4779impl core::convert::From<L2capConnectionRspResultCode> for i64 { fn from(val: L2capConnectionRspResultCode) -> Self { val as i64 } }
4780
4781impl emboss_runtime::SafeCmp<L2capConnectionRspResultCode> for L2capConnectionRspResultCode {
4782 fn safe_eq(&self, other: Self) -> bool { *self == other }
4783 fn safe_less(&self, other: Self) -> bool { (*self as u64) < (other as u64) }
4784}
4785
4786impl emboss_runtime::SafeCmp<u64> for L2capConnectionRspResultCode {
4787 fn safe_eq(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
4788 fn safe_less(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
4789}
4790
4791impl emboss_runtime::SafeCmp<i64> for L2capConnectionRspResultCode {
4792 fn safe_eq(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
4793 fn safe_less(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
4794}
4795
4796impl emboss_runtime::SafeCmp<i32> for L2capConnectionRspResultCode {
4797 fn safe_eq(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as i64) }
4798 fn safe_less(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as i64) }
4799}
4800
4801impl emboss_runtime::SafeCmp<u32> for L2capConnectionRspResultCode {
4802 fn safe_eq(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as u64) }
4803 fn safe_less(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as u64) }
4804}
4805
4806impl emboss_runtime::SafeCmp<L2capConnectionRspResultCode> for u64 {
4807 fn safe_eq(&self, other: L2capConnectionRspResultCode) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
4808 fn safe_less(&self, other: L2capConnectionRspResultCode) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
4809}
4810
4811impl emboss_runtime::SafeCmp<L2capConnectionRspResultCode> for i64 {
4812 fn safe_eq(&self, other: L2capConnectionRspResultCode) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
4813 fn safe_less(&self, other: L2capConnectionRspResultCode) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
4814}
4815
4816impl<V: core::convert::Into<u64> + core::marker::Copy> emboss_runtime::TryFromRaw<V> for L2capConnectionRspResultCode {
4817 fn try_from_raw(val: V) -> core::result::Result<Self, emboss_runtime::Error<V>> {
4818 let v_raw: u64 = val.into();
4819 match v_raw {
4820 0 => Ok(L2capConnectionRspResultCode::SUCCESSFUL),
4821 1 => Ok(L2capConnectionRspResultCode::PENDING),
4822 2 => Ok(L2capConnectionRspResultCode::PSM_NOT_SUPPORTED),
4823 3 => Ok(L2capConnectionRspResultCode::SECURITY_BLOCK),
4824 4 => Ok(L2capConnectionRspResultCode::NO_RESOURCES_AVAILABLE),
4825 5 => Ok(L2capConnectionRspResultCode::INVALID_SOURCE_CID),
4826 6 => Ok(L2capConnectionRspResultCode::SOURCE_CID_ALREADY_ALLOCATED),
4827
4828 _ => Err(emboss_runtime::Error::UnknownEnum(val)),
4829 }
4830 }
4831}
4832
4833impl L2capConnectionRspResultCode {
4834
4835}
4836#[derive(Copy, Clone, Debug, Eq, PartialEq)]
4837#[repr(u64)]
4838pub enum L2capConnectionRspStatusCode {
4839 NO_INFORMATION = 0,
4840 AUTHENTICATION_PENDING = 1,
4841 AUTHORIZATION_PENDING = 2,
4842
4843}
4844
4845impl core::convert::From<L2capConnectionRspStatusCode> for u8 { fn from(val: L2capConnectionRspStatusCode) -> Self { val as u8 } }
4846impl core::convert::From<L2capConnectionRspStatusCode> for u16 { fn from(val: L2capConnectionRspStatusCode) -> Self { val as u16 } }
4847impl core::convert::From<L2capConnectionRspStatusCode> for u32 { fn from(val: L2capConnectionRspStatusCode) -> Self { val as u32 } }
4848impl core::convert::From<L2capConnectionRspStatusCode> for u64 { fn from(val: L2capConnectionRspStatusCode) -> Self { val as u64 } }
4849impl core::convert::From<L2capConnectionRspStatusCode> for i8 { fn from(val: L2capConnectionRspStatusCode) -> Self { val as i8 } }
4850impl core::convert::From<L2capConnectionRspStatusCode> for i16 { fn from(val: L2capConnectionRspStatusCode) -> Self { val as i16 } }
4851impl core::convert::From<L2capConnectionRspStatusCode> for i32 { fn from(val: L2capConnectionRspStatusCode) -> Self { val as i32 } }
4852impl core::convert::From<L2capConnectionRspStatusCode> for i64 { fn from(val: L2capConnectionRspStatusCode) -> Self { val as i64 } }
4853
4854impl emboss_runtime::SafeCmp<L2capConnectionRspStatusCode> for L2capConnectionRspStatusCode {
4855 fn safe_eq(&self, other: Self) -> bool { *self == other }
4856 fn safe_less(&self, other: Self) -> bool { (*self as u64) < (other as u64) }
4857}
4858
4859impl emboss_runtime::SafeCmp<u64> for L2capConnectionRspStatusCode {
4860 fn safe_eq(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
4861 fn safe_less(&self, other: u64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
4862}
4863
4864impl emboss_runtime::SafeCmp<i64> for L2capConnectionRspStatusCode {
4865 fn safe_eq(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other) }
4866 fn safe_less(&self, other: i64) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other) }
4867}
4868
4869impl emboss_runtime::SafeCmp<i32> for L2capConnectionRspStatusCode {
4870 fn safe_eq(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as i64) }
4871 fn safe_less(&self, other: i32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as i64) }
4872}
4873
4874impl emboss_runtime::SafeCmp<u32> for L2capConnectionRspStatusCode {
4875 fn safe_eq(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_eq(&(*self as u64), other as u64) }
4876 fn safe_less(&self, other: u32) -> bool { emboss_runtime::SafeCmp::safe_less(&(*self as u64), other as u64) }
4877}
4878
4879impl emboss_runtime::SafeCmp<L2capConnectionRspStatusCode> for u64 {
4880 fn safe_eq(&self, other: L2capConnectionRspStatusCode) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
4881 fn safe_less(&self, other: L2capConnectionRspStatusCode) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
4882}
4883
4884impl emboss_runtime::SafeCmp<L2capConnectionRspStatusCode> for i64 {
4885 fn safe_eq(&self, other: L2capConnectionRspStatusCode) -> bool { emboss_runtime::SafeCmp::safe_eq(self, other as u64) }
4886 fn safe_less(&self, other: L2capConnectionRspStatusCode) -> bool { emboss_runtime::SafeCmp::safe_less(self, other as u64) }
4887}
4888
4889impl<V: core::convert::Into<u64> + core::marker::Copy> emboss_runtime::TryFromRaw<V> for L2capConnectionRspStatusCode {
4890 fn try_from_raw(val: V) -> core::result::Result<Self, emboss_runtime::Error<V>> {
4891 let v_raw: u64 = val.into();
4892 match v_raw {
4893 0 => Ok(L2capConnectionRspStatusCode::NO_INFORMATION),
4894 1 => Ok(L2capConnectionRspStatusCode::AUTHENTICATION_PENDING),
4895 2 => Ok(L2capConnectionRspStatusCode::AUTHORIZATION_PENDING),
4896
4897 _ => Err(emboss_runtime::Error::UnknownEnum(val)),
4898 }
4899 }
4900}
4901
4902impl L2capConnectionRspStatusCode {
4903
4904}
4905pub struct L2capConnectionRsp<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
4906 storage: S,
4907 _marker: core::marker::PhantomData<ST>,
4908}
4909
4910impl<S: emboss_runtime::Storage> L2capConnectionRsp<S, emboss_runtime::UncheckedState> {
4911 pub fn new(storage: S) -> Self {
4912 Self {
4913 storage,
4914 _marker: core::marker::PhantomData,
4915 }
4916 }
4917}
4918
4919impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capConnectionRsp<S, ST> {
4920 fn clone(&self) -> Self {
4921 Self {
4922 storage: self.storage.clone(),
4923 _marker: core::marker::PhantomData,
4924 }
4925 }
4926}
4927
4928impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capConnectionRsp<S, ST> {
4929 pub unsafe fn new_in_state(storage: S) -> Self {
4937 Self {
4938 storage,
4939 _marker: core::marker::PhantomData,
4940 }
4941 }
4942 pub fn into_storage(self) -> S {
4943 self.storage
4944 }
4945 pub fn command_header(&self) -> L2capSignalingCommandHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
4946 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4947 let offset = (0) as usize;
4948 let len = (4) as usize;
4949 core::result::Result::Ok((offset, len))
4950 })().unwrap_or((usize::MAX, 0));
4951 let storage = self.storage.slice(offset, len);
4952 unsafe { L2capSignalingCommandHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
4953 }
4954 pub fn destination_cid(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
4955 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4956 let offset = (4) as usize;
4957 let len = (2) as usize;
4958 core::result::Result::Ok((offset, len))
4959 })().unwrap_or((usize::MAX, 0));
4960 let storage = self.storage.slice(offset, len);
4961 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
4962 }
4963 pub fn source_cid(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
4964 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4965 let offset = (6) as usize;
4966 let len = (2) as usize;
4967 core::result::Result::Ok((offset, len))
4968 })().unwrap_or((usize::MAX, 0));
4969 let storage = self.storage.slice(offset, len);
4970 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
4971 }
4972 pub fn result(&self) -> emboss_runtime::EnumView<L2capConnectionRspResultCode, emboss_runtime::UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>> {
4973 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
4974 let offset = (8) as usize;
4975 let len = (2) as usize;
4976 core::result::Result::Ok((offset, len))
4977 })().unwrap_or((usize::MAX, 0));
4978 let storage = self.storage.slice(offset, len);
4979 emboss_runtime::EnumView::new(emboss_runtime::UInt::new(storage))
4980 }
4981
4982}
4983
4984pub struct L2capConnectionRspMut<S: emboss_runtime::MutStorage> {
4985 storage: S,
4986}
4987
4988impl<S: emboss_runtime::MutStorage> L2capConnectionRspMut<S> {
4989 pub fn new(storage: S) -> Self {
4990 Self {
4991 storage,
4992 }
4993 }
4994 pub fn into_writer(self) -> L2capConnectionRspWriter<S, emboss_runtime::UncheckedState> {
4995 L2capConnectionRspWriter::new(self.storage)
4996 }
4997 pub fn as_view(&self) -> L2capConnectionRsp<S::Sliced<'_>, emboss_runtime::UncheckedState> {
4999 unsafe { L2capConnectionRsp::new_in_state(self.storage.slice(0, self.storage.len())) }
5000 }
5001 pub fn command_header(&mut self) -> L2capSignalingCommandHeaderMut<S::SlicedMut<'_>> {
5002 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5003 let offset = (0) as usize;
5004 let len = (4) as usize;
5005 core::result::Result::Ok((offset, len))
5006 })().unwrap_or((usize::MAX, 0));
5007 let storage = self.storage.slice_mut(offset, len);
5008 L2capSignalingCommandHeaderMut::<S::SlicedMut<'_>>::new(storage)
5009 }
5010 pub fn destination_cid(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
5011 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5012 let offset = (4) as usize;
5013 let len = (2) as usize;
5014 core::result::Result::Ok((offset, len))
5015 })().unwrap_or((usize::MAX, 0));
5016 let storage = self.storage.slice_mut(offset, len);
5017 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
5018 }
5019 pub fn source_cid(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
5020 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5021 let offset = (6) as usize;
5022 let len = (2) as usize;
5023 core::result::Result::Ok((offset, len))
5024 })().unwrap_or((usize::MAX, 0));
5025 let storage = self.storage.slice_mut(offset, len);
5026 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
5027 }
5028 pub fn result(&mut self) -> emboss_runtime::EnumViewMut<L2capConnectionRspResultCode, emboss_runtime::UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>> {
5029 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5030 let offset = (8) as usize;
5031 let len = (2) as usize;
5032 core::result::Result::Ok((offset, len))
5033 })().unwrap_or((usize::MAX, 0));
5034 let storage = self.storage.slice_mut(offset, len);
5035 emboss_runtime::EnumViewMut::new(emboss_runtime::UInt::new(storage))
5036 }
5037
5038}
5039
5040impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capConnectionRspMut<S> {
5041 type Writer = L2capConnectionRspWriter<S, emboss_runtime::UncheckedState>;
5042 fn into_writer(self) -> Self::Writer {
5043 L2capConnectionRspWriter::new(self.storage)
5044 }
5045}
5046
5047pub struct L2capConnectionRspWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
5048 storage: S,
5049 _marker: core::marker::PhantomData<ST>,
5050}
5051
5052impl<S: emboss_runtime::MutStorage> L2capConnectionRspWriter<S, emboss_runtime::UncheckedState> {
5053 pub fn new(storage: S) -> Self {
5054 Self {
5055 storage,
5056 _marker: core::marker::PhantomData,
5057 }
5058 }
5059}
5060
5061impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capConnectionRspWriter<S, ST> {
5062 pub unsafe fn new_in_state(storage: S) -> Self {
5070 Self {
5071 storage,
5072 _marker: core::marker::PhantomData,
5073 }
5074 }
5075 pub fn into_storage(self) -> S {
5076 self.storage
5077 }
5078 pub fn into_view(self) -> L2capConnectionRsp<S, ST> {
5080 unsafe { L2capConnectionRsp::new_in_state(self.storage) }
5081 }
5082 pub fn as_view(&self) -> L2capConnectionRsp<S::Sliced<'_>, ST> {
5084 unsafe { L2capConnectionRsp::new_in_state(self.storage.slice(0, self.storage.len())) }
5085 }
5086 pub fn write_destination_cid(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capConnectionRspWriter<S, ST::OnValidMutation> {
5087 let view = self.into_view();
5088 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5089 let offset = (4) as usize;
5090 let len = (2) as usize;
5091 core::result::Result::Ok((offset, len))
5092 })().expect("valid layout in complete state");
5093 let mut storage = view.into_storage();
5094 {
5095 let slice = storage.slice_mut(offset, len);
5096 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
5097 field_view.try_write(val).expect("valid write in complete state");
5098 }
5099 unsafe { L2capConnectionRspWriter::new_in_state(storage) }
5100 }
5101 pub fn write_source_cid(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capConnectionRspWriter<S, ST::OnValidMutation> {
5102 let view = self.into_view();
5103 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5104 let offset = (6) as usize;
5105 let len = (2) as usize;
5106 core::result::Result::Ok((offset, len))
5107 })().expect("valid layout in complete state");
5108 let mut storage = view.into_storage();
5109 {
5110 let slice = storage.slice_mut(offset, len);
5111 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
5112 field_view.try_write(val).expect("valid write in complete state");
5113 }
5114 unsafe { L2capConnectionRspWriter::new_in_state(storage) }
5115 }
5116 pub fn write_result(self, val: L2capConnectionRspResultCode) -> L2capConnectionRspWriter<S, ST::OnLayoutMutation> {
5117 let view = self.into_view();
5118 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5119 let offset = (8) as usize;
5120 let len = (2) as usize;
5121 core::result::Result::Ok((offset, len))
5122 })().expect("valid layout in complete state");
5123 let mut storage = view.into_storage();
5124 {
5125 let slice = storage.slice_mut(offset, len);
5126 let mut field_view = emboss_runtime::EnumViewMut::<L2capConnectionRspResultCode, emboss_runtime::UInt<16, emboss_runtime::LittleEndian, _>>::new(emboss_runtime::UInt::new(slice));
5127 field_view.try_write(val).expect("valid write in complete state");
5128 }
5129 unsafe { L2capConnectionRspWriter::new_in_state(storage) }
5130 }
5131
5132}
5133
5134impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capConnectionRsp<S, ST> {
5135 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
5136 let view = self;
5137 core::result::Result::Ok((core::cmp::max((core::cmp::max((core::cmp::max((core::cmp::max((core::cmp::max((0) as i64, (4) as i64)
5138) as i64, (6) as i64)
5139) as i64, (8) as i64)
5140) as i64, (10) as i64)
5141) as i64, ((if emboss_runtime::SafeCmp::safe_eq(&(({ let val = view.result().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
5142), (1) as u64)
5143 { 12 } else { 0 })
5144
5145) as i64)
5146) as usize)
5147 }
5148}
5149
5150impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capConnectionRspMut<S> {
5151 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
5152 let view = self.as_view();
5153 <L2capConnectionRsp<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
5154 }
5155}
5156
5157impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capConnectionRspWriter<S, ST> {
5158 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
5159 let view = self.as_view();
5160 <L2capConnectionRsp<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
5161 }
5162}
5163
5164impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capConnectionRsp<S, emboss_runtime::UncheckedState> {
5165 type Completed = L2capConnectionRsp<S, emboss_runtime::CompleteState>;
5166 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
5167 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
5168 if self.storage.len() < required_size {
5169 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
5170 }
5171 core::result::Result::Ok(unsafe { L2capConnectionRsp::new_in_state(self.storage) })
5172 }
5173}
5174
5175impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capConnectionRspWriter<S, emboss_runtime::UncheckedState> {
5176 type Completed = L2capConnectionRspWriter<S, emboss_runtime::CompleteState>;
5177 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
5178 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
5179 if self.storage.len() < required_size {
5180 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
5181 }
5182 core::result::Result::Ok(unsafe { L2capConnectionRspWriter::new_in_state(self.storage) })
5183 }
5184}
5185
5186impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConnectionRsp<S, emboss_runtime::UncheckedState> {
5187 type Ok = L2capConnectionRsp<S, emboss_runtime::OkState>;
5188 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5189 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
5190 core::result::Result::Ok(unsafe { L2capConnectionRsp::new_in_state(completed.into_storage()) })
5191 }
5192}
5193
5194impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConnectionRsp<S, emboss_runtime::CompleteState> {
5195 type Ok = L2capConnectionRsp<S, emboss_runtime::OkState>;
5196 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5197 core::result::Result::Ok(unsafe { L2capConnectionRsp::new_in_state(self.into_storage()) })
5198 }
5199}
5200
5201impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConnectionRsp<S, emboss_runtime::OkState> {
5202 type Ok = L2capConnectionRsp<S, emboss_runtime::OkState>;
5203 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5204 core::result::Result::Ok(self)
5205 }
5206}
5207
5208impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConnectionRspWriter<S, emboss_runtime::UncheckedState> {
5209 type Ok = L2capConnectionRspWriter<S, emboss_runtime::OkState>;
5210 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5211 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
5212 core::result::Result::Ok(unsafe { L2capConnectionRspWriter::new_in_state(completed.into_storage()) })
5213 }
5214}
5215
5216impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConnectionRspWriter<S, emboss_runtime::CompleteState> {
5217 type Ok = L2capConnectionRspWriter<S, emboss_runtime::OkState>;
5218 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5219 core::result::Result::Ok(unsafe { L2capConnectionRspWriter::new_in_state(self.into_storage()) })
5220 }
5221}
5222
5223impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConnectionRspWriter<S, emboss_runtime::OkState> {
5224 type Ok = L2capConnectionRspWriter<S, emboss_runtime::OkState>;
5225 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5226 core::result::Result::Ok(self)
5227 }
5228}
5229
5230pub mod l2cap_connection_rsp {
5231 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capConnectionRsp<S, ST>;
5232 pub type ViewMut<S> = super::L2capConnectionRspMut<S>;
5233 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capConnectionRspWriter<S, ST>;
5234
5235 pub const MIN_SIZE_IN_BYTES: usize = 10;
5236 pub const MAX_SIZE_IN_BYTES: usize = 12;
5237}pub struct L2capConfigureReq_EmbossReservedAnonymousField2<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
5238 storage: S,
5239 _marker: core::marker::PhantomData<ST>,
5240}
5241
5242impl<S: emboss_runtime::Storage> L2capConfigureReq_EmbossReservedAnonymousField2<S, emboss_runtime::UncheckedState> {
5243 pub fn new(storage: S) -> Self {
5244 Self {
5245 storage,
5246 _marker: core::marker::PhantomData,
5247 }
5248 }
5249}
5250
5251impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capConfigureReq_EmbossReservedAnonymousField2<S, ST> {
5252 fn clone(&self) -> Self {
5253 Self {
5254 storage: self.storage.clone(),
5255 _marker: core::marker::PhantomData,
5256 }
5257 }
5258}
5259
5260impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capConfigureReq_EmbossReservedAnonymousField2<S, ST> {
5261 pub unsafe fn new_in_state(storage: S) -> Self {
5269 Self {
5270 storage,
5271 _marker: core::marker::PhantomData,
5272 }
5273 }
5274 pub fn into_storage(self) -> S {
5275 self.storage
5276 }
5277 pub fn rfu(&self) -> emboss_runtime::BitUInt<15, 0, emboss_runtime::Null, S::Sliced<'_>, ST> {
5278 let len = (2) as usize; let storage = self.storage.slice(0, len);
5280 emboss_runtime::BitUInt::<15, 0, emboss_runtime::Null, S::Sliced<'_>, ST>::new(storage)
5281 }
5282 pub fn continuation_flag(&self) -> emboss_runtime::BitFlag<1, 15, emboss_runtime::Null, S::Sliced<'_>, ST> {
5283 let len = (2) as usize; let storage = self.storage.slice(0, len);
5285 emboss_runtime::BitFlag::<1, 15, emboss_runtime::Null, S::Sliced<'_>, ST>::new(storage)
5286 }
5287
5288}
5289
5290pub struct L2capConfigureReq_EmbossReservedAnonymousField2Mut<S: emboss_runtime::MutStorage> {
5291 storage: S,
5292}
5293
5294impl<S: emboss_runtime::MutStorage> L2capConfigureReq_EmbossReservedAnonymousField2Mut<S> {
5295 pub fn new(storage: S) -> Self {
5296 Self {
5297 storage,
5298 }
5299 }
5300 pub fn into_writer(self) -> L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, emboss_runtime::UncheckedState> {
5301 L2capConfigureReq_EmbossReservedAnonymousField2Writer::new(self.storage)
5302 }
5303 pub fn as_view(&self) -> L2capConfigureReq_EmbossReservedAnonymousField2<S::Sliced<'_>, emboss_runtime::UncheckedState> {
5305 unsafe { L2capConfigureReq_EmbossReservedAnonymousField2::new_in_state(self.storage.slice(0, self.storage.len())) }
5306 }
5307 pub fn rfu(&mut self) -> emboss_runtime::BitUInt<15, 0, emboss_runtime::Null, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
5308 let len = (2) as usize;
5309 let storage = self.storage.slice_mut(0, len);
5310 emboss_runtime::BitUInt::<15, 0, emboss_runtime::Null, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
5311 }
5312 pub fn continuation_flag(&mut self) -> emboss_runtime::BitFlag<1, 15, emboss_runtime::Null, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
5313 let len = (2) as usize;
5314 let storage = self.storage.slice_mut(0, len);
5315 emboss_runtime::BitFlag::<1, 15, emboss_runtime::Null, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
5316 }
5317
5318}
5319
5320impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capConfigureReq_EmbossReservedAnonymousField2Mut<S> {
5321 type Writer = L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, emboss_runtime::UncheckedState>;
5322 fn into_writer(self) -> Self::Writer {
5323 L2capConfigureReq_EmbossReservedAnonymousField2Writer::new(self.storage)
5324 }
5325}
5326
5327pub struct L2capConfigureReq_EmbossReservedAnonymousField2Writer<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
5328 storage: S,
5329 _marker: core::marker::PhantomData<ST>,
5330}
5331
5332impl<S: emboss_runtime::MutStorage> L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, emboss_runtime::UncheckedState> {
5333 pub fn new(storage: S) -> Self {
5334 Self {
5335 storage,
5336 _marker: core::marker::PhantomData,
5337 }
5338 }
5339}
5340
5341impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, ST> {
5342 pub unsafe fn new_in_state(storage: S) -> Self {
5350 Self {
5351 storage,
5352 _marker: core::marker::PhantomData,
5353 }
5354 }
5355 pub fn into_storage(self) -> S {
5356 self.storage
5357 }
5358 pub fn into_view(self) -> L2capConfigureReq_EmbossReservedAnonymousField2<S, ST> {
5360 unsafe { L2capConfigureReq_EmbossReservedAnonymousField2::new_in_state(self.storage) }
5361 }
5362 pub fn as_view(&self) -> L2capConfigureReq_EmbossReservedAnonymousField2<S::Sliced<'_>, ST> {
5364 unsafe { L2capConfigureReq_EmbossReservedAnonymousField2::new_in_state(self.storage.slice(0, self.storage.len())) }
5365 }
5366
5367}
5368
5369impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capConfigureReq_EmbossReservedAnonymousField2<S, ST> {
5370 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
5371 let view = self;
5372 core::result::Result::Ok((((16) + 7) / 8) as usize)
5373 }
5374}
5375
5376impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capConfigureReq_EmbossReservedAnonymousField2Mut<S> {
5377 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
5378 let view = self.as_view();
5379 <L2capConfigureReq_EmbossReservedAnonymousField2<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
5380 }
5381}
5382
5383impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, ST> {
5384 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
5385 let view = self.as_view();
5386 <L2capConfigureReq_EmbossReservedAnonymousField2<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
5387 }
5388}
5389
5390impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capConfigureReq_EmbossReservedAnonymousField2<S, emboss_runtime::UncheckedState> {
5391 type Completed = L2capConfigureReq_EmbossReservedAnonymousField2<S, emboss_runtime::CompleteState>;
5392 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
5393 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
5394 if self.storage.len() < required_size {
5395 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
5396 }
5397 core::result::Result::Ok(unsafe { L2capConfigureReq_EmbossReservedAnonymousField2::new_in_state(self.storage) })
5398 }
5399}
5400
5401impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, emboss_runtime::UncheckedState> {
5402 type Completed = L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, emboss_runtime::CompleteState>;
5403 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
5404 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
5405 if self.storage.len() < required_size {
5406 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
5407 }
5408 core::result::Result::Ok(unsafe { L2capConfigureReq_EmbossReservedAnonymousField2Writer::new_in_state(self.storage) })
5409 }
5410}
5411
5412impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigureReq_EmbossReservedAnonymousField2<S, emboss_runtime::UncheckedState> {
5413 type Ok = L2capConfigureReq_EmbossReservedAnonymousField2<S, emboss_runtime::OkState>;
5414 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5415 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
5416 core::result::Result::Ok(unsafe { L2capConfigureReq_EmbossReservedAnonymousField2::new_in_state(completed.into_storage()) })
5417 }
5418}
5419
5420impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigureReq_EmbossReservedAnonymousField2<S, emboss_runtime::CompleteState> {
5421 type Ok = L2capConfigureReq_EmbossReservedAnonymousField2<S, emboss_runtime::OkState>;
5422 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5423 core::result::Result::Ok(unsafe { L2capConfigureReq_EmbossReservedAnonymousField2::new_in_state(self.into_storage()) })
5424 }
5425}
5426
5427impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigureReq_EmbossReservedAnonymousField2<S, emboss_runtime::OkState> {
5428 type Ok = L2capConfigureReq_EmbossReservedAnonymousField2<S, emboss_runtime::OkState>;
5429 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5430 core::result::Result::Ok(self)
5431 }
5432}
5433
5434impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, emboss_runtime::UncheckedState> {
5435 type Ok = L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, emboss_runtime::OkState>;
5436 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5437 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
5438 core::result::Result::Ok(unsafe { L2capConfigureReq_EmbossReservedAnonymousField2Writer::new_in_state(completed.into_storage()) })
5439 }
5440}
5441
5442impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, emboss_runtime::CompleteState> {
5443 type Ok = L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, emboss_runtime::OkState>;
5444 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5445 core::result::Result::Ok(unsafe { L2capConfigureReq_EmbossReservedAnonymousField2Writer::new_in_state(self.into_storage()) })
5446 }
5447}
5448
5449impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, emboss_runtime::OkState> {
5450 type Ok = L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, emboss_runtime::OkState>;
5451 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5452 core::result::Result::Ok(self)
5453 }
5454}
5455
5456pub mod l2cap_configure_req_emboss_reserved_anonymous_field2 {
5457 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capConfigureReq_EmbossReservedAnonymousField2<S, ST>;
5458 pub type ViewMut<S> = super::L2capConfigureReq_EmbossReservedAnonymousField2Mut<S>;
5459 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capConfigureReq_EmbossReservedAnonymousField2Writer<S, ST>;
5460
5461 pub const MIN_SIZE_IN_BYTES: usize = 2;
5462 pub const MAX_SIZE_IN_BYTES: usize = 2;
5463 pub const SIZE_IN_BYTES: usize = 2;
5464}pub struct L2capConfigureReq<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
5465 storage: S,
5466 _marker: core::marker::PhantomData<ST>,
5467}
5468
5469impl<S: emboss_runtime::Storage> L2capConfigureReq<S, emboss_runtime::UncheckedState> {
5470 pub fn new(storage: S) -> Self {
5471 Self {
5472 storage,
5473 _marker: core::marker::PhantomData,
5474 }
5475 }
5476}
5477
5478impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capConfigureReq<S, ST> {
5479 fn clone(&self) -> Self {
5480 Self {
5481 storage: self.storage.clone(),
5482 _marker: core::marker::PhantomData,
5483 }
5484 }
5485}
5486
5487impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capConfigureReq<S, ST> {
5488 pub unsafe fn new_in_state(storage: S) -> Self {
5496 Self {
5497 storage,
5498 _marker: core::marker::PhantomData,
5499 }
5500 }
5501 pub fn into_storage(self) -> S {
5502 self.storage
5503 }
5504 pub fn command_header(&self) -> L2capSignalingCommandHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
5505 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5506 let offset = (0) as usize;
5507 let len = (4) as usize;
5508 core::result::Result::Ok((offset, len))
5509 })().unwrap_or((usize::MAX, 0));
5510 let storage = self.storage.slice(offset, len);
5511 unsafe { L2capSignalingCommandHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
5512 }
5513 pub fn destination_cid(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
5514 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5515 let offset = (4) as usize;
5516 let len = (2) as usize;
5517 core::result::Result::Ok((offset, len))
5518 })().unwrap_or((usize::MAX, 0));
5519 let storage = self.storage.slice(offset, len);
5520 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
5521 }
5522 pub fn emboss_reserved_anonymous_field_2(&self) -> L2capConfigureReq_EmbossReservedAnonymousField2<S::Sliced<'_>, emboss_runtime::UncheckedState> {
5523 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5524 let offset = (6) as usize;
5525 let len = (2) as usize;
5526 core::result::Result::Ok((offset, len))
5527 })().unwrap_or((usize::MAX, 0));
5528 let storage = self.storage.slice(offset, len);
5529 unsafe { L2capConfigureReq_EmbossReservedAnonymousField2::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
5530 }
5531 pub fn rfu(&self) -> emboss_runtime::VirtualField<u64> {
5532 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
5533 core::result::Result::Ok( (({ let val = self.emboss_reserved_anonymous_field_2().rfu().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
5534) as u64 )
5535 })();
5536 emboss_runtime::VirtualField::new(value)
5537 }
5538 pub fn continuation_flag(&self) -> emboss_runtime::VirtualField<bool> {
5539 let value = (|| -> core::result::Result<bool, emboss_runtime::Error> {
5540 core::result::Result::Ok( (({ let val = self.emboss_reserved_anonymous_field_2().continuation_flag().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
5541) )
5542 })();
5543 emboss_runtime::VirtualField::new(value)
5544 }
5545
5546}
5547
5548pub struct L2capConfigureReqMut<S: emboss_runtime::MutStorage> {
5549 storage: S,
5550}
5551
5552impl<S: emboss_runtime::MutStorage> L2capConfigureReqMut<S> {
5553 pub fn new(storage: S) -> Self {
5554 Self {
5555 storage,
5556 }
5557 }
5558 pub fn into_writer(self) -> L2capConfigureReqWriter<S, emboss_runtime::UncheckedState> {
5559 L2capConfigureReqWriter::new(self.storage)
5560 }
5561 pub fn as_view(&self) -> L2capConfigureReq<S::Sliced<'_>, emboss_runtime::UncheckedState> {
5563 unsafe { L2capConfigureReq::new_in_state(self.storage.slice(0, self.storage.len())) }
5564 }
5565 pub fn command_header(&mut self) -> L2capSignalingCommandHeaderMut<S::SlicedMut<'_>> {
5566 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5567 let offset = (0) as usize;
5568 let len = (4) as usize;
5569 core::result::Result::Ok((offset, len))
5570 })().unwrap_or((usize::MAX, 0));
5571 let storage = self.storage.slice_mut(offset, len);
5572 L2capSignalingCommandHeaderMut::<S::SlicedMut<'_>>::new(storage)
5573 }
5574 pub fn destination_cid(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
5575 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5576 let offset = (4) as usize;
5577 let len = (2) as usize;
5578 core::result::Result::Ok((offset, len))
5579 })().unwrap_or((usize::MAX, 0));
5580 let storage = self.storage.slice_mut(offset, len);
5581 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
5582 }
5583 pub fn emboss_reserved_anonymous_field_2(&mut self) -> L2capConfigureReq_EmbossReservedAnonymousField2Mut<S::SlicedMut<'_>> {
5584 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5585 let offset = (6) as usize;
5586 let len = (2) as usize;
5587 core::result::Result::Ok((offset, len))
5588 })().unwrap_or((usize::MAX, 0));
5589 let storage = self.storage.slice_mut(offset, len);
5590 L2capConfigureReq_EmbossReservedAnonymousField2Mut::<S::SlicedMut<'_>>::new(storage)
5591 }
5592 pub fn rfu(&mut self) -> emboss_runtime::VirtualField<u64> {
5593 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
5594 core::result::Result::Ok( (({ let val = self.emboss_reserved_anonymous_field_2().rfu().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
5595) as u64 )
5596 })();
5597 emboss_runtime::VirtualField::new(value)
5598 }
5599 pub fn continuation_flag(&mut self) -> emboss_runtime::VirtualField<bool> {
5600 let value = (|| -> core::result::Result<bool, emboss_runtime::Error> {
5601 core::result::Result::Ok( (({ let val = self.emboss_reserved_anonymous_field_2().continuation_flag().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
5602) )
5603 })();
5604 emboss_runtime::VirtualField::new(value)
5605 }
5606
5607}
5608
5609impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capConfigureReqMut<S> {
5610 type Writer = L2capConfigureReqWriter<S, emboss_runtime::UncheckedState>;
5611 fn into_writer(self) -> Self::Writer {
5612 L2capConfigureReqWriter::new(self.storage)
5613 }
5614}
5615
5616pub struct L2capConfigureReqWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
5617 storage: S,
5618 _marker: core::marker::PhantomData<ST>,
5619}
5620
5621impl<S: emboss_runtime::MutStorage> L2capConfigureReqWriter<S, emboss_runtime::UncheckedState> {
5622 pub fn new(storage: S) -> Self {
5623 Self {
5624 storage,
5625 _marker: core::marker::PhantomData,
5626 }
5627 }
5628}
5629
5630impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capConfigureReqWriter<S, ST> {
5631 pub unsafe fn new_in_state(storage: S) -> Self {
5639 Self {
5640 storage,
5641 _marker: core::marker::PhantomData,
5642 }
5643 }
5644 pub fn into_storage(self) -> S {
5645 self.storage
5646 }
5647 pub fn into_view(self) -> L2capConfigureReq<S, ST> {
5649 unsafe { L2capConfigureReq::new_in_state(self.storage) }
5650 }
5651 pub fn as_view(&self) -> L2capConfigureReq<S::Sliced<'_>, ST> {
5653 unsafe { L2capConfigureReq::new_in_state(self.storage.slice(0, self.storage.len())) }
5654 }
5655 pub fn write_destination_cid(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capConfigureReqWriter<S, ST::OnValidMutation> {
5656 let view = self.into_view();
5657 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
5658 let offset = (4) as usize;
5659 let len = (2) as usize;
5660 core::result::Result::Ok((offset, len))
5661 })().expect("valid layout in complete state");
5662 let mut storage = view.into_storage();
5663 {
5664 let slice = storage.slice_mut(offset, len);
5665 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
5666 field_view.try_write(val).expect("valid write in complete state");
5667 }
5668 unsafe { L2capConfigureReqWriter::new_in_state(storage) }
5669 }
5670
5671}
5672
5673impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capConfigureReq<S, ST> {
5674 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
5675 let view = self;
5676 core::result::Result::Ok((0) as usize)
5677 }
5678}
5679
5680impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capConfigureReqMut<S> {
5681 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
5682 let view = self.as_view();
5683 <L2capConfigureReq<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
5684 }
5685}
5686
5687impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capConfigureReqWriter<S, ST> {
5688 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
5689 let view = self.as_view();
5690 <L2capConfigureReq<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
5691 }
5692}
5693
5694impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capConfigureReq<S, emboss_runtime::UncheckedState> {
5695 type Completed = L2capConfigureReq<S, emboss_runtime::CompleteState>;
5696 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
5697 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
5698 if self.storage.len() < required_size {
5699 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
5700 }
5701 core::result::Result::Ok(unsafe { L2capConfigureReq::new_in_state(self.storage) })
5702 }
5703}
5704
5705impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capConfigureReqWriter<S, emboss_runtime::UncheckedState> {
5706 type Completed = L2capConfigureReqWriter<S, emboss_runtime::CompleteState>;
5707 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
5708 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
5709 if self.storage.len() < required_size {
5710 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
5711 }
5712 core::result::Result::Ok(unsafe { L2capConfigureReqWriter::new_in_state(self.storage) })
5713 }
5714}
5715
5716impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigureReq<S, emboss_runtime::UncheckedState> {
5717 type Ok = L2capConfigureReq<S, emboss_runtime::OkState>;
5718 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5719 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
5720 core::result::Result::Ok(unsafe { L2capConfigureReq::new_in_state(completed.into_storage()) })
5721 }
5722}
5723
5724impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigureReq<S, emboss_runtime::CompleteState> {
5725 type Ok = L2capConfigureReq<S, emboss_runtime::OkState>;
5726 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5727 core::result::Result::Ok(unsafe { L2capConfigureReq::new_in_state(self.into_storage()) })
5728 }
5729}
5730
5731impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigureReq<S, emboss_runtime::OkState> {
5732 type Ok = L2capConfigureReq<S, emboss_runtime::OkState>;
5733 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5734 core::result::Result::Ok(self)
5735 }
5736}
5737
5738impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigureReqWriter<S, emboss_runtime::UncheckedState> {
5739 type Ok = L2capConfigureReqWriter<S, emboss_runtime::OkState>;
5740 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5741 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
5742 core::result::Result::Ok(unsafe { L2capConfigureReqWriter::new_in_state(completed.into_storage()) })
5743 }
5744}
5745
5746impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigureReqWriter<S, emboss_runtime::CompleteState> {
5747 type Ok = L2capConfigureReqWriter<S, emboss_runtime::OkState>;
5748 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5749 core::result::Result::Ok(unsafe { L2capConfigureReqWriter::new_in_state(self.into_storage()) })
5750 }
5751}
5752
5753impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigureReqWriter<S, emboss_runtime::OkState> {
5754 type Ok = L2capConfigureReqWriter<S, emboss_runtime::OkState>;
5755 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5756 core::result::Result::Ok(self)
5757 }
5758}
5759
5760pub mod l2cap_configure_req {
5761 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capConfigureReq<S, ST>;
5762 pub type ViewMut<S> = super::L2capConfigureReqMut<S>;
5763 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capConfigureReqWriter<S, ST>;
5764
5765 pub const MIN_SIZE_IN_BYTES: usize = 8;
5766 pub const MAX_SIZE_IN_BYTES: usize = 4294967295;
5767}pub struct L2capConfigureRsp_EmbossReservedAnonymousField1<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
5768 storage: S,
5769 _marker: core::marker::PhantomData<ST>,
5770}
5771
5772impl<S: emboss_runtime::Storage> L2capConfigureRsp_EmbossReservedAnonymousField1<S, emboss_runtime::UncheckedState> {
5773 pub fn new(storage: S) -> Self {
5774 Self {
5775 storage,
5776 _marker: core::marker::PhantomData,
5777 }
5778 }
5779}
5780
5781impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capConfigureRsp_EmbossReservedAnonymousField1<S, ST> {
5782 fn clone(&self) -> Self {
5783 Self {
5784 storage: self.storage.clone(),
5785 _marker: core::marker::PhantomData,
5786 }
5787 }
5788}
5789
5790impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capConfigureRsp_EmbossReservedAnonymousField1<S, ST> {
5791 pub unsafe fn new_in_state(storage: S) -> Self {
5799 Self {
5800 storage,
5801 _marker: core::marker::PhantomData,
5802 }
5803 }
5804 pub fn into_storage(self) -> S {
5805 self.storage
5806 }
5807 pub fn rfu(&self) -> emboss_runtime::BitUInt<15, 0, emboss_runtime::Null, S::Sliced<'_>, ST> {
5808 let len = (2) as usize; let storage = self.storage.slice(0, len);
5810 emboss_runtime::BitUInt::<15, 0, emboss_runtime::Null, S::Sliced<'_>, ST>::new(storage)
5811 }
5812 pub fn continuation_flag(&self) -> emboss_runtime::BitFlag<1, 15, emboss_runtime::Null, S::Sliced<'_>, ST> {
5813 let len = (2) as usize; let storage = self.storage.slice(0, len);
5815 emboss_runtime::BitFlag::<1, 15, emboss_runtime::Null, S::Sliced<'_>, ST>::new(storage)
5816 }
5817
5818}
5819
5820pub struct L2capConfigureRsp_EmbossReservedAnonymousField1Mut<S: emboss_runtime::MutStorage> {
5821 storage: S,
5822}
5823
5824impl<S: emboss_runtime::MutStorage> L2capConfigureRsp_EmbossReservedAnonymousField1Mut<S> {
5825 pub fn new(storage: S) -> Self {
5826 Self {
5827 storage,
5828 }
5829 }
5830 pub fn into_writer(self) -> L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, emboss_runtime::UncheckedState> {
5831 L2capConfigureRsp_EmbossReservedAnonymousField1Writer::new(self.storage)
5832 }
5833 pub fn as_view(&self) -> L2capConfigureRsp_EmbossReservedAnonymousField1<S::Sliced<'_>, emboss_runtime::UncheckedState> {
5835 unsafe { L2capConfigureRsp_EmbossReservedAnonymousField1::new_in_state(self.storage.slice(0, self.storage.len())) }
5836 }
5837 pub fn rfu(&mut self) -> emboss_runtime::BitUInt<15, 0, emboss_runtime::Null, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
5838 let len = (2) as usize;
5839 let storage = self.storage.slice_mut(0, len);
5840 emboss_runtime::BitUInt::<15, 0, emboss_runtime::Null, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
5841 }
5842 pub fn continuation_flag(&mut self) -> emboss_runtime::BitFlag<1, 15, emboss_runtime::Null, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
5843 let len = (2) as usize;
5844 let storage = self.storage.slice_mut(0, len);
5845 emboss_runtime::BitFlag::<1, 15, emboss_runtime::Null, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
5846 }
5847
5848}
5849
5850impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capConfigureRsp_EmbossReservedAnonymousField1Mut<S> {
5851 type Writer = L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, emboss_runtime::UncheckedState>;
5852 fn into_writer(self) -> Self::Writer {
5853 L2capConfigureRsp_EmbossReservedAnonymousField1Writer::new(self.storage)
5854 }
5855}
5856
5857pub struct L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
5858 storage: S,
5859 _marker: core::marker::PhantomData<ST>,
5860}
5861
5862impl<S: emboss_runtime::MutStorage> L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, emboss_runtime::UncheckedState> {
5863 pub fn new(storage: S) -> Self {
5864 Self {
5865 storage,
5866 _marker: core::marker::PhantomData,
5867 }
5868 }
5869}
5870
5871impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, ST> {
5872 pub unsafe fn new_in_state(storage: S) -> Self {
5880 Self {
5881 storage,
5882 _marker: core::marker::PhantomData,
5883 }
5884 }
5885 pub fn into_storage(self) -> S {
5886 self.storage
5887 }
5888 pub fn into_view(self) -> L2capConfigureRsp_EmbossReservedAnonymousField1<S, ST> {
5890 unsafe { L2capConfigureRsp_EmbossReservedAnonymousField1::new_in_state(self.storage) }
5891 }
5892 pub fn as_view(&self) -> L2capConfigureRsp_EmbossReservedAnonymousField1<S::Sliced<'_>, ST> {
5894 unsafe { L2capConfigureRsp_EmbossReservedAnonymousField1::new_in_state(self.storage.slice(0, self.storage.len())) }
5895 }
5896
5897}
5898
5899impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capConfigureRsp_EmbossReservedAnonymousField1<S, ST> {
5900 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
5901 let view = self;
5902 core::result::Result::Ok((((16) + 7) / 8) as usize)
5903 }
5904}
5905
5906impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capConfigureRsp_EmbossReservedAnonymousField1Mut<S> {
5907 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
5908 let view = self.as_view();
5909 <L2capConfigureRsp_EmbossReservedAnonymousField1<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
5910 }
5911}
5912
5913impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, ST> {
5914 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
5915 let view = self.as_view();
5916 <L2capConfigureRsp_EmbossReservedAnonymousField1<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
5917 }
5918}
5919
5920impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capConfigureRsp_EmbossReservedAnonymousField1<S, emboss_runtime::UncheckedState> {
5921 type Completed = L2capConfigureRsp_EmbossReservedAnonymousField1<S, emboss_runtime::CompleteState>;
5922 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
5923 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
5924 if self.storage.len() < required_size {
5925 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
5926 }
5927 core::result::Result::Ok(unsafe { L2capConfigureRsp_EmbossReservedAnonymousField1::new_in_state(self.storage) })
5928 }
5929}
5930
5931impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, emboss_runtime::UncheckedState> {
5932 type Completed = L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, emboss_runtime::CompleteState>;
5933 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
5934 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
5935 if self.storage.len() < required_size {
5936 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
5937 }
5938 core::result::Result::Ok(unsafe { L2capConfigureRsp_EmbossReservedAnonymousField1Writer::new_in_state(self.storage) })
5939 }
5940}
5941
5942impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigureRsp_EmbossReservedAnonymousField1<S, emboss_runtime::UncheckedState> {
5943 type Ok = L2capConfigureRsp_EmbossReservedAnonymousField1<S, emboss_runtime::OkState>;
5944 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5945 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
5946 core::result::Result::Ok(unsafe { L2capConfigureRsp_EmbossReservedAnonymousField1::new_in_state(completed.into_storage()) })
5947 }
5948}
5949
5950impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigureRsp_EmbossReservedAnonymousField1<S, emboss_runtime::CompleteState> {
5951 type Ok = L2capConfigureRsp_EmbossReservedAnonymousField1<S, emboss_runtime::OkState>;
5952 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5953 core::result::Result::Ok(unsafe { L2capConfigureRsp_EmbossReservedAnonymousField1::new_in_state(self.into_storage()) })
5954 }
5955}
5956
5957impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigureRsp_EmbossReservedAnonymousField1<S, emboss_runtime::OkState> {
5958 type Ok = L2capConfigureRsp_EmbossReservedAnonymousField1<S, emboss_runtime::OkState>;
5959 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5960 core::result::Result::Ok(self)
5961 }
5962}
5963
5964impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, emboss_runtime::UncheckedState> {
5965 type Ok = L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, emboss_runtime::OkState>;
5966 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5967 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
5968 core::result::Result::Ok(unsafe { L2capConfigureRsp_EmbossReservedAnonymousField1Writer::new_in_state(completed.into_storage()) })
5969 }
5970}
5971
5972impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, emboss_runtime::CompleteState> {
5973 type Ok = L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, emboss_runtime::OkState>;
5974 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5975 core::result::Result::Ok(unsafe { L2capConfigureRsp_EmbossReservedAnonymousField1Writer::new_in_state(self.into_storage()) })
5976 }
5977}
5978
5979impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, emboss_runtime::OkState> {
5980 type Ok = L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, emboss_runtime::OkState>;
5981 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
5982 core::result::Result::Ok(self)
5983 }
5984}
5985
5986pub mod l2cap_configure_rsp_emboss_reserved_anonymous_field1 {
5987 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capConfigureRsp_EmbossReservedAnonymousField1<S, ST>;
5988 pub type ViewMut<S> = super::L2capConfigureRsp_EmbossReservedAnonymousField1Mut<S>;
5989 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capConfigureRsp_EmbossReservedAnonymousField1Writer<S, ST>;
5990
5991 pub const MIN_SIZE_IN_BYTES: usize = 2;
5992 pub const MAX_SIZE_IN_BYTES: usize = 2;
5993 pub const SIZE_IN_BYTES: usize = 2;
5994}pub struct L2capConfigureRsp<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
5995 storage: S,
5996 _marker: core::marker::PhantomData<ST>,
5997}
5998
5999impl<S: emboss_runtime::Storage> L2capConfigureRsp<S, emboss_runtime::UncheckedState> {
6000 pub fn new(storage: S) -> Self {
6001 Self {
6002 storage,
6003 _marker: core::marker::PhantomData,
6004 }
6005 }
6006}
6007
6008impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capConfigureRsp<S, ST> {
6009 fn clone(&self) -> Self {
6010 Self {
6011 storage: self.storage.clone(),
6012 _marker: core::marker::PhantomData,
6013 }
6014 }
6015}
6016
6017impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capConfigureRsp<S, ST> {
6018 pub unsafe fn new_in_state(storage: S) -> Self {
6026 Self {
6027 storage,
6028 _marker: core::marker::PhantomData,
6029 }
6030 }
6031 pub fn into_storage(self) -> S {
6032 self.storage
6033 }
6034 pub fn command_header(&self) -> L2capSignalingCommandHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
6035 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6036 let offset = (0) as usize;
6037 let len = (4) as usize;
6038 core::result::Result::Ok((offset, len))
6039 })().unwrap_or((usize::MAX, 0));
6040 let storage = self.storage.slice(offset, len);
6041 unsafe { L2capSignalingCommandHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
6042 }
6043 pub fn source_cid(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
6044 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6045 let offset = (4) as usize;
6046 let len = (2) as usize;
6047 core::result::Result::Ok((offset, len))
6048 })().unwrap_or((usize::MAX, 0));
6049 let storage = self.storage.slice(offset, len);
6050 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
6051 }
6052 pub fn emboss_reserved_anonymous_field_1(&self) -> L2capConfigureRsp_EmbossReservedAnonymousField1<S::Sliced<'_>, emboss_runtime::UncheckedState> {
6053 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6054 let offset = (6) as usize;
6055 let len = (2) as usize;
6056 core::result::Result::Ok((offset, len))
6057 })().unwrap_or((usize::MAX, 0));
6058 let storage = self.storage.slice(offset, len);
6059 unsafe { L2capConfigureRsp_EmbossReservedAnonymousField1::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
6060 }
6061 pub fn rfu(&self) -> emboss_runtime::VirtualField<u64> {
6062 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
6063 core::result::Result::Ok( (({ let val = self.emboss_reserved_anonymous_field_1().rfu().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
6064) as u64 )
6065 })();
6066 emboss_runtime::VirtualField::new(value)
6067 }
6068 pub fn continuation_flag(&self) -> emboss_runtime::VirtualField<bool> {
6069 let value = (|| -> core::result::Result<bool, emboss_runtime::Error> {
6070 core::result::Result::Ok( (({ let val = self.emboss_reserved_anonymous_field_1().continuation_flag().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
6071) )
6072 })();
6073 emboss_runtime::VirtualField::new(value)
6074 }
6075 pub fn result(&self) -> emboss_runtime::EnumView<L2capConfigurationResult, emboss_runtime::UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>> {
6076 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6077 let offset = (8) as usize;
6078 let len = (2) as usize;
6079 core::result::Result::Ok((offset, len))
6080 })().unwrap_or((usize::MAX, 0));
6081 let storage = self.storage.slice(offset, len);
6082 emboss_runtime::EnumView::new(emboss_runtime::UInt::new(storage))
6083 }
6084
6085}
6086
6087pub struct L2capConfigureRspMut<S: emboss_runtime::MutStorage> {
6088 storage: S,
6089}
6090
6091impl<S: emboss_runtime::MutStorage> L2capConfigureRspMut<S> {
6092 pub fn new(storage: S) -> Self {
6093 Self {
6094 storage,
6095 }
6096 }
6097 pub fn into_writer(self) -> L2capConfigureRspWriter<S, emboss_runtime::UncheckedState> {
6098 L2capConfigureRspWriter::new(self.storage)
6099 }
6100 pub fn as_view(&self) -> L2capConfigureRsp<S::Sliced<'_>, emboss_runtime::UncheckedState> {
6102 unsafe { L2capConfigureRsp::new_in_state(self.storage.slice(0, self.storage.len())) }
6103 }
6104 pub fn command_header(&mut self) -> L2capSignalingCommandHeaderMut<S::SlicedMut<'_>> {
6105 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6106 let offset = (0) as usize;
6107 let len = (4) as usize;
6108 core::result::Result::Ok((offset, len))
6109 })().unwrap_or((usize::MAX, 0));
6110 let storage = self.storage.slice_mut(offset, len);
6111 L2capSignalingCommandHeaderMut::<S::SlicedMut<'_>>::new(storage)
6112 }
6113 pub fn source_cid(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
6114 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6115 let offset = (4) as usize;
6116 let len = (2) as usize;
6117 core::result::Result::Ok((offset, len))
6118 })().unwrap_or((usize::MAX, 0));
6119 let storage = self.storage.slice_mut(offset, len);
6120 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
6121 }
6122 pub fn emboss_reserved_anonymous_field_1(&mut self) -> L2capConfigureRsp_EmbossReservedAnonymousField1Mut<S::SlicedMut<'_>> {
6123 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6124 let offset = (6) as usize;
6125 let len = (2) as usize;
6126 core::result::Result::Ok((offset, len))
6127 })().unwrap_or((usize::MAX, 0));
6128 let storage = self.storage.slice_mut(offset, len);
6129 L2capConfigureRsp_EmbossReservedAnonymousField1Mut::<S::SlicedMut<'_>>::new(storage)
6130 }
6131 pub fn rfu(&mut self) -> emboss_runtime::VirtualField<u64> {
6132 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
6133 core::result::Result::Ok( (({ let val = self.emboss_reserved_anonymous_field_1().rfu().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
6134) as u64 )
6135 })();
6136 emboss_runtime::VirtualField::new(value)
6137 }
6138 pub fn continuation_flag(&mut self) -> emboss_runtime::VirtualField<bool> {
6139 let value = (|| -> core::result::Result<bool, emboss_runtime::Error> {
6140 core::result::Result::Ok( (({ let val = self.emboss_reserved_anonymous_field_1().continuation_flag().try_read().map_err(|e| match e { emboss_runtime::Error::OutOfBounds => emboss_runtime::Error::OutOfBounds, emboss_runtime::Error::UnknownEnum(_) => emboss_runtime::Error::UnknownEnum(()) })?; val })
6141) )
6142 })();
6143 emboss_runtime::VirtualField::new(value)
6144 }
6145 pub fn result(&mut self) -> emboss_runtime::EnumViewMut<L2capConfigurationResult, emboss_runtime::UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>> {
6146 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6147 let offset = (8) as usize;
6148 let len = (2) as usize;
6149 core::result::Result::Ok((offset, len))
6150 })().unwrap_or((usize::MAX, 0));
6151 let storage = self.storage.slice_mut(offset, len);
6152 emboss_runtime::EnumViewMut::new(emboss_runtime::UInt::new(storage))
6153 }
6154
6155}
6156
6157impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capConfigureRspMut<S> {
6158 type Writer = L2capConfigureRspWriter<S, emboss_runtime::UncheckedState>;
6159 fn into_writer(self) -> Self::Writer {
6160 L2capConfigureRspWriter::new(self.storage)
6161 }
6162}
6163
6164pub struct L2capConfigureRspWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
6165 storage: S,
6166 _marker: core::marker::PhantomData<ST>,
6167}
6168
6169impl<S: emboss_runtime::MutStorage> L2capConfigureRspWriter<S, emboss_runtime::UncheckedState> {
6170 pub fn new(storage: S) -> Self {
6171 Self {
6172 storage,
6173 _marker: core::marker::PhantomData,
6174 }
6175 }
6176}
6177
6178impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capConfigureRspWriter<S, ST> {
6179 pub unsafe fn new_in_state(storage: S) -> Self {
6187 Self {
6188 storage,
6189 _marker: core::marker::PhantomData,
6190 }
6191 }
6192 pub fn into_storage(self) -> S {
6193 self.storage
6194 }
6195 pub fn into_view(self) -> L2capConfigureRsp<S, ST> {
6197 unsafe { L2capConfigureRsp::new_in_state(self.storage) }
6198 }
6199 pub fn as_view(&self) -> L2capConfigureRsp<S::Sliced<'_>, ST> {
6201 unsafe { L2capConfigureRsp::new_in_state(self.storage.slice(0, self.storage.len())) }
6202 }
6203 pub fn write_source_cid(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capConfigureRspWriter<S, ST::OnValidMutation> {
6204 let view = self.into_view();
6205 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6206 let offset = (4) as usize;
6207 let len = (2) as usize;
6208 core::result::Result::Ok((offset, len))
6209 })().expect("valid layout in complete state");
6210 let mut storage = view.into_storage();
6211 {
6212 let slice = storage.slice_mut(offset, len);
6213 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
6214 field_view.try_write(val).expect("valid write in complete state");
6215 }
6216 unsafe { L2capConfigureRspWriter::new_in_state(storage) }
6217 }
6218 pub fn write_result(self, val: L2capConfigurationResult) -> L2capConfigureRspWriter<S, ST::OnValidMutation> {
6219 let view = self.into_view();
6220 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6221 let offset = (8) as usize;
6222 let len = (2) as usize;
6223 core::result::Result::Ok((offset, len))
6224 })().expect("valid layout in complete state");
6225 let mut storage = view.into_storage();
6226 {
6227 let slice = storage.slice_mut(offset, len);
6228 let mut field_view = emboss_runtime::EnumViewMut::<L2capConfigurationResult, emboss_runtime::UInt<16, emboss_runtime::LittleEndian, _>>::new(emboss_runtime::UInt::new(slice));
6229 field_view.try_write(val).expect("valid write in complete state");
6230 }
6231 unsafe { L2capConfigureRspWriter::new_in_state(storage) }
6232 }
6233
6234}
6235
6236impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capConfigureRsp<S, ST> {
6237 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
6238 let view = self;
6239 core::result::Result::Ok((0) as usize)
6240 }
6241}
6242
6243impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capConfigureRspMut<S> {
6244 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
6245 let view = self.as_view();
6246 <L2capConfigureRsp<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
6247 }
6248}
6249
6250impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capConfigureRspWriter<S, ST> {
6251 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
6252 let view = self.as_view();
6253 <L2capConfigureRsp<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
6254 }
6255}
6256
6257impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capConfigureRsp<S, emboss_runtime::UncheckedState> {
6258 type Completed = L2capConfigureRsp<S, emboss_runtime::CompleteState>;
6259 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
6260 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
6261 if self.storage.len() < required_size {
6262 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
6263 }
6264 core::result::Result::Ok(unsafe { L2capConfigureRsp::new_in_state(self.storage) })
6265 }
6266}
6267
6268impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capConfigureRspWriter<S, emboss_runtime::UncheckedState> {
6269 type Completed = L2capConfigureRspWriter<S, emboss_runtime::CompleteState>;
6270 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
6271 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
6272 if self.storage.len() < required_size {
6273 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
6274 }
6275 core::result::Result::Ok(unsafe { L2capConfigureRspWriter::new_in_state(self.storage) })
6276 }
6277}
6278
6279impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigureRsp<S, emboss_runtime::UncheckedState> {
6280 type Ok = L2capConfigureRsp<S, emboss_runtime::OkState>;
6281 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6282 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
6283 core::result::Result::Ok(unsafe { L2capConfigureRsp::new_in_state(completed.into_storage()) })
6284 }
6285}
6286
6287impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigureRsp<S, emboss_runtime::CompleteState> {
6288 type Ok = L2capConfigureRsp<S, emboss_runtime::OkState>;
6289 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6290 core::result::Result::Ok(unsafe { L2capConfigureRsp::new_in_state(self.into_storage()) })
6291 }
6292}
6293
6294impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capConfigureRsp<S, emboss_runtime::OkState> {
6295 type Ok = L2capConfigureRsp<S, emboss_runtime::OkState>;
6296 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6297 core::result::Result::Ok(self)
6298 }
6299}
6300
6301impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigureRspWriter<S, emboss_runtime::UncheckedState> {
6302 type Ok = L2capConfigureRspWriter<S, emboss_runtime::OkState>;
6303 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6304 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
6305 core::result::Result::Ok(unsafe { L2capConfigureRspWriter::new_in_state(completed.into_storage()) })
6306 }
6307}
6308
6309impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigureRspWriter<S, emboss_runtime::CompleteState> {
6310 type Ok = L2capConfigureRspWriter<S, emboss_runtime::OkState>;
6311 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6312 core::result::Result::Ok(unsafe { L2capConfigureRspWriter::new_in_state(self.into_storage()) })
6313 }
6314}
6315
6316impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capConfigureRspWriter<S, emboss_runtime::OkState> {
6317 type Ok = L2capConfigureRspWriter<S, emboss_runtime::OkState>;
6318 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6319 core::result::Result::Ok(self)
6320 }
6321}
6322
6323pub mod l2cap_configure_rsp {
6324 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capConfigureRsp<S, ST>;
6325 pub type ViewMut<S> = super::L2capConfigureRspMut<S>;
6326 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capConfigureRspWriter<S, ST>;
6327
6328 pub const MIN_SIZE_IN_BYTES: usize = 10;
6329 pub const MAX_SIZE_IN_BYTES: usize = 4294967295;
6330}pub struct L2capDisconnectionReq<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
6331 storage: S,
6332 _marker: core::marker::PhantomData<ST>,
6333}
6334
6335impl<S: emboss_runtime::Storage> L2capDisconnectionReq<S, emboss_runtime::UncheckedState> {
6336 pub fn new(storage: S) -> Self {
6337 Self {
6338 storage,
6339 _marker: core::marker::PhantomData,
6340 }
6341 }
6342}
6343
6344impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capDisconnectionReq<S, ST> {
6345 fn clone(&self) -> Self {
6346 Self {
6347 storage: self.storage.clone(),
6348 _marker: core::marker::PhantomData,
6349 }
6350 }
6351}
6352
6353impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capDisconnectionReq<S, ST> {
6354 pub unsafe fn new_in_state(storage: S) -> Self {
6362 Self {
6363 storage,
6364 _marker: core::marker::PhantomData,
6365 }
6366 }
6367 pub fn into_storage(self) -> S {
6368 self.storage
6369 }
6370 pub fn command_header(&self) -> L2capSignalingCommandHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
6371 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6372 let offset = (0) as usize;
6373 let len = (4) as usize;
6374 core::result::Result::Ok((offset, len))
6375 })().unwrap_or((usize::MAX, 0));
6376 let storage = self.storage.slice(offset, len);
6377 unsafe { L2capSignalingCommandHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
6378 }
6379 pub fn destination_cid(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
6380 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6381 let offset = (4) as usize;
6382 let len = (2) as usize;
6383 core::result::Result::Ok((offset, len))
6384 })().unwrap_or((usize::MAX, 0));
6385 let storage = self.storage.slice(offset, len);
6386 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
6387 }
6388 pub fn source_cid(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
6389 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6390 let offset = (6) as usize;
6391 let len = (2) as usize;
6392 core::result::Result::Ok((offset, len))
6393 })().unwrap_or((usize::MAX, 0));
6394 let storage = self.storage.slice(offset, len);
6395 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
6396 }
6397
6398}
6399
6400pub struct L2capDisconnectionReqMut<S: emboss_runtime::MutStorage> {
6401 storage: S,
6402}
6403
6404impl<S: emboss_runtime::MutStorage> L2capDisconnectionReqMut<S> {
6405 pub fn new(storage: S) -> Self {
6406 Self {
6407 storage,
6408 }
6409 }
6410 pub fn into_writer(self) -> L2capDisconnectionReqWriter<S, emboss_runtime::UncheckedState> {
6411 L2capDisconnectionReqWriter::new(self.storage)
6412 }
6413 pub fn as_view(&self) -> L2capDisconnectionReq<S::Sliced<'_>, emboss_runtime::UncheckedState> {
6415 unsafe { L2capDisconnectionReq::new_in_state(self.storage.slice(0, self.storage.len())) }
6416 }
6417 pub fn command_header(&mut self) -> L2capSignalingCommandHeaderMut<S::SlicedMut<'_>> {
6418 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6419 let offset = (0) as usize;
6420 let len = (4) as usize;
6421 core::result::Result::Ok((offset, len))
6422 })().unwrap_or((usize::MAX, 0));
6423 let storage = self.storage.slice_mut(offset, len);
6424 L2capSignalingCommandHeaderMut::<S::SlicedMut<'_>>::new(storage)
6425 }
6426 pub fn destination_cid(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
6427 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6428 let offset = (4) as usize;
6429 let len = (2) as usize;
6430 core::result::Result::Ok((offset, len))
6431 })().unwrap_or((usize::MAX, 0));
6432 let storage = self.storage.slice_mut(offset, len);
6433 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
6434 }
6435 pub fn source_cid(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
6436 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6437 let offset = (6) as usize;
6438 let len = (2) as usize;
6439 core::result::Result::Ok((offset, len))
6440 })().unwrap_or((usize::MAX, 0));
6441 let storage = self.storage.slice_mut(offset, len);
6442 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
6443 }
6444
6445}
6446
6447impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capDisconnectionReqMut<S> {
6448 type Writer = L2capDisconnectionReqWriter<S, emboss_runtime::UncheckedState>;
6449 fn into_writer(self) -> Self::Writer {
6450 L2capDisconnectionReqWriter::new(self.storage)
6451 }
6452}
6453
6454pub struct L2capDisconnectionReqWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
6455 storage: S,
6456 _marker: core::marker::PhantomData<ST>,
6457}
6458
6459impl<S: emboss_runtime::MutStorage> L2capDisconnectionReqWriter<S, emboss_runtime::UncheckedState> {
6460 pub fn new(storage: S) -> Self {
6461 Self {
6462 storage,
6463 _marker: core::marker::PhantomData,
6464 }
6465 }
6466}
6467
6468impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capDisconnectionReqWriter<S, ST> {
6469 pub unsafe fn new_in_state(storage: S) -> Self {
6477 Self {
6478 storage,
6479 _marker: core::marker::PhantomData,
6480 }
6481 }
6482 pub fn into_storage(self) -> S {
6483 self.storage
6484 }
6485 pub fn into_view(self) -> L2capDisconnectionReq<S, ST> {
6487 unsafe { L2capDisconnectionReq::new_in_state(self.storage) }
6488 }
6489 pub fn as_view(&self) -> L2capDisconnectionReq<S::Sliced<'_>, ST> {
6491 unsafe { L2capDisconnectionReq::new_in_state(self.storage.slice(0, self.storage.len())) }
6492 }
6493 pub fn write_destination_cid(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capDisconnectionReqWriter<S, ST::OnValidMutation> {
6494 let view = self.into_view();
6495 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6496 let offset = (4) as usize;
6497 let len = (2) as usize;
6498 core::result::Result::Ok((offset, len))
6499 })().expect("valid layout in complete state");
6500 let mut storage = view.into_storage();
6501 {
6502 let slice = storage.slice_mut(offset, len);
6503 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
6504 field_view.try_write(val).expect("valid write in complete state");
6505 }
6506 unsafe { L2capDisconnectionReqWriter::new_in_state(storage) }
6507 }
6508 pub fn write_source_cid(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capDisconnectionReqWriter<S, ST::OnValidMutation> {
6509 let view = self.into_view();
6510 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6511 let offset = (6) as usize;
6512 let len = (2) as usize;
6513 core::result::Result::Ok((offset, len))
6514 })().expect("valid layout in complete state");
6515 let mut storage = view.into_storage();
6516 {
6517 let slice = storage.slice_mut(offset, len);
6518 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
6519 field_view.try_write(val).expect("valid write in complete state");
6520 }
6521 unsafe { L2capDisconnectionReqWriter::new_in_state(storage) }
6522 }
6523
6524}
6525
6526impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capDisconnectionReq<S, ST> {
6527 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
6528 let view = self;
6529 core::result::Result::Ok((8) as usize)
6530 }
6531}
6532
6533impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capDisconnectionReqMut<S> {
6534 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
6535 let view = self.as_view();
6536 <L2capDisconnectionReq<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
6537 }
6538}
6539
6540impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capDisconnectionReqWriter<S, ST> {
6541 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
6542 let view = self.as_view();
6543 <L2capDisconnectionReq<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
6544 }
6545}
6546
6547impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capDisconnectionReq<S, emboss_runtime::UncheckedState> {
6548 type Completed = L2capDisconnectionReq<S, emboss_runtime::CompleteState>;
6549 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
6550 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
6551 if self.storage.len() < required_size {
6552 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
6553 }
6554 core::result::Result::Ok(unsafe { L2capDisconnectionReq::new_in_state(self.storage) })
6555 }
6556}
6557
6558impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capDisconnectionReqWriter<S, emboss_runtime::UncheckedState> {
6559 type Completed = L2capDisconnectionReqWriter<S, emboss_runtime::CompleteState>;
6560 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
6561 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
6562 if self.storage.len() < required_size {
6563 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
6564 }
6565 core::result::Result::Ok(unsafe { L2capDisconnectionReqWriter::new_in_state(self.storage) })
6566 }
6567}
6568
6569impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capDisconnectionReq<S, emboss_runtime::UncheckedState> {
6570 type Ok = L2capDisconnectionReq<S, emboss_runtime::OkState>;
6571 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6572 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
6573 core::result::Result::Ok(unsafe { L2capDisconnectionReq::new_in_state(completed.into_storage()) })
6574 }
6575}
6576
6577impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capDisconnectionReq<S, emboss_runtime::CompleteState> {
6578 type Ok = L2capDisconnectionReq<S, emboss_runtime::OkState>;
6579 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6580 core::result::Result::Ok(unsafe { L2capDisconnectionReq::new_in_state(self.into_storage()) })
6581 }
6582}
6583
6584impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capDisconnectionReq<S, emboss_runtime::OkState> {
6585 type Ok = L2capDisconnectionReq<S, emboss_runtime::OkState>;
6586 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6587 core::result::Result::Ok(self)
6588 }
6589}
6590
6591impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capDisconnectionReqWriter<S, emboss_runtime::UncheckedState> {
6592 type Ok = L2capDisconnectionReqWriter<S, emboss_runtime::OkState>;
6593 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6594 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
6595 core::result::Result::Ok(unsafe { L2capDisconnectionReqWriter::new_in_state(completed.into_storage()) })
6596 }
6597}
6598
6599impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capDisconnectionReqWriter<S, emboss_runtime::CompleteState> {
6600 type Ok = L2capDisconnectionReqWriter<S, emboss_runtime::OkState>;
6601 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6602 core::result::Result::Ok(unsafe { L2capDisconnectionReqWriter::new_in_state(self.into_storage()) })
6603 }
6604}
6605
6606impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capDisconnectionReqWriter<S, emboss_runtime::OkState> {
6607 type Ok = L2capDisconnectionReqWriter<S, emboss_runtime::OkState>;
6608 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6609 core::result::Result::Ok(self)
6610 }
6611}
6612
6613pub mod l2cap_disconnection_req {
6614 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capDisconnectionReq<S, ST>;
6615 pub type ViewMut<S> = super::L2capDisconnectionReqMut<S>;
6616 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capDisconnectionReqWriter<S, ST>;
6617
6618 pub const MIN_SIZE_IN_BYTES: usize = 8;
6619 pub const MAX_SIZE_IN_BYTES: usize = 8;
6620 pub const SIZE_IN_BYTES: usize = 8;
6621}pub struct L2capDisconnectionRsp<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
6622 storage: S,
6623 _marker: core::marker::PhantomData<ST>,
6624}
6625
6626impl<S: emboss_runtime::Storage> L2capDisconnectionRsp<S, emboss_runtime::UncheckedState> {
6627 pub fn new(storage: S) -> Self {
6628 Self {
6629 storage,
6630 _marker: core::marker::PhantomData,
6631 }
6632 }
6633}
6634
6635impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capDisconnectionRsp<S, ST> {
6636 fn clone(&self) -> Self {
6637 Self {
6638 storage: self.storage.clone(),
6639 _marker: core::marker::PhantomData,
6640 }
6641 }
6642}
6643
6644impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capDisconnectionRsp<S, ST> {
6645 pub unsafe fn new_in_state(storage: S) -> Self {
6653 Self {
6654 storage,
6655 _marker: core::marker::PhantomData,
6656 }
6657 }
6658 pub fn into_storage(self) -> S {
6659 self.storage
6660 }
6661 pub fn command_header(&self) -> L2capSignalingCommandHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
6662 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6663 let offset = (0) as usize;
6664 let len = (4) as usize;
6665 core::result::Result::Ok((offset, len))
6666 })().unwrap_or((usize::MAX, 0));
6667 let storage = self.storage.slice(offset, len);
6668 unsafe { L2capSignalingCommandHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
6669 }
6670 pub fn destination_cid(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
6671 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6672 let offset = (4) as usize;
6673 let len = (2) as usize;
6674 core::result::Result::Ok((offset, len))
6675 })().unwrap_or((usize::MAX, 0));
6676 let storage = self.storage.slice(offset, len);
6677 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
6678 }
6679 pub fn source_cid(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
6680 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6681 let offset = (6) as usize;
6682 let len = (2) as usize;
6683 core::result::Result::Ok((offset, len))
6684 })().unwrap_or((usize::MAX, 0));
6685 let storage = self.storage.slice(offset, len);
6686 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
6687 }
6688
6689}
6690
6691pub struct L2capDisconnectionRspMut<S: emboss_runtime::MutStorage> {
6692 storage: S,
6693}
6694
6695impl<S: emboss_runtime::MutStorage> L2capDisconnectionRspMut<S> {
6696 pub fn new(storage: S) -> Self {
6697 Self {
6698 storage,
6699 }
6700 }
6701 pub fn into_writer(self) -> L2capDisconnectionRspWriter<S, emboss_runtime::UncheckedState> {
6702 L2capDisconnectionRspWriter::new(self.storage)
6703 }
6704 pub fn as_view(&self) -> L2capDisconnectionRsp<S::Sliced<'_>, emboss_runtime::UncheckedState> {
6706 unsafe { L2capDisconnectionRsp::new_in_state(self.storage.slice(0, self.storage.len())) }
6707 }
6708 pub fn command_header(&mut self) -> L2capSignalingCommandHeaderMut<S::SlicedMut<'_>> {
6709 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6710 let offset = (0) as usize;
6711 let len = (4) as usize;
6712 core::result::Result::Ok((offset, len))
6713 })().unwrap_or((usize::MAX, 0));
6714 let storage = self.storage.slice_mut(offset, len);
6715 L2capSignalingCommandHeaderMut::<S::SlicedMut<'_>>::new(storage)
6716 }
6717 pub fn destination_cid(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
6718 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6719 let offset = (4) as usize;
6720 let len = (2) as usize;
6721 core::result::Result::Ok((offset, len))
6722 })().unwrap_or((usize::MAX, 0));
6723 let storage = self.storage.slice_mut(offset, len);
6724 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
6725 }
6726 pub fn source_cid(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
6727 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6728 let offset = (6) as usize;
6729 let len = (2) as usize;
6730 core::result::Result::Ok((offset, len))
6731 })().unwrap_or((usize::MAX, 0));
6732 let storage = self.storage.slice_mut(offset, len);
6733 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
6734 }
6735
6736}
6737
6738impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capDisconnectionRspMut<S> {
6739 type Writer = L2capDisconnectionRspWriter<S, emboss_runtime::UncheckedState>;
6740 fn into_writer(self) -> Self::Writer {
6741 L2capDisconnectionRspWriter::new(self.storage)
6742 }
6743}
6744
6745pub struct L2capDisconnectionRspWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
6746 storage: S,
6747 _marker: core::marker::PhantomData<ST>,
6748}
6749
6750impl<S: emboss_runtime::MutStorage> L2capDisconnectionRspWriter<S, emboss_runtime::UncheckedState> {
6751 pub fn new(storage: S) -> Self {
6752 Self {
6753 storage,
6754 _marker: core::marker::PhantomData,
6755 }
6756 }
6757}
6758
6759impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capDisconnectionRspWriter<S, ST> {
6760 pub unsafe fn new_in_state(storage: S) -> Self {
6768 Self {
6769 storage,
6770 _marker: core::marker::PhantomData,
6771 }
6772 }
6773 pub fn into_storage(self) -> S {
6774 self.storage
6775 }
6776 pub fn into_view(self) -> L2capDisconnectionRsp<S, ST> {
6778 unsafe { L2capDisconnectionRsp::new_in_state(self.storage) }
6779 }
6780 pub fn as_view(&self) -> L2capDisconnectionRsp<S::Sliced<'_>, ST> {
6782 unsafe { L2capDisconnectionRsp::new_in_state(self.storage.slice(0, self.storage.len())) }
6783 }
6784 pub fn write_destination_cid(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capDisconnectionRspWriter<S, ST::OnValidMutation> {
6785 let view = self.into_view();
6786 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6787 let offset = (4) as usize;
6788 let len = (2) as usize;
6789 core::result::Result::Ok((offset, len))
6790 })().expect("valid layout in complete state");
6791 let mut storage = view.into_storage();
6792 {
6793 let slice = storage.slice_mut(offset, len);
6794 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
6795 field_view.try_write(val).expect("valid write in complete state");
6796 }
6797 unsafe { L2capDisconnectionRspWriter::new_in_state(storage) }
6798 }
6799 pub fn write_source_cid(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capDisconnectionRspWriter<S, ST::OnValidMutation> {
6800 let view = self.into_view();
6801 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6802 let offset = (6) as usize;
6803 let len = (2) as usize;
6804 core::result::Result::Ok((offset, len))
6805 })().expect("valid layout in complete state");
6806 let mut storage = view.into_storage();
6807 {
6808 let slice = storage.slice_mut(offset, len);
6809 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
6810 field_view.try_write(val).expect("valid write in complete state");
6811 }
6812 unsafe { L2capDisconnectionRspWriter::new_in_state(storage) }
6813 }
6814
6815}
6816
6817impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capDisconnectionRsp<S, ST> {
6818 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
6819 let view = self;
6820 core::result::Result::Ok((8) as usize)
6821 }
6822}
6823
6824impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capDisconnectionRspMut<S> {
6825 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
6826 let view = self.as_view();
6827 <L2capDisconnectionRsp<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
6828 }
6829}
6830
6831impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capDisconnectionRspWriter<S, ST> {
6832 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
6833 let view = self.as_view();
6834 <L2capDisconnectionRsp<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
6835 }
6836}
6837
6838impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capDisconnectionRsp<S, emboss_runtime::UncheckedState> {
6839 type Completed = L2capDisconnectionRsp<S, emboss_runtime::CompleteState>;
6840 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
6841 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
6842 if self.storage.len() < required_size {
6843 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
6844 }
6845 core::result::Result::Ok(unsafe { L2capDisconnectionRsp::new_in_state(self.storage) })
6846 }
6847}
6848
6849impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capDisconnectionRspWriter<S, emboss_runtime::UncheckedState> {
6850 type Completed = L2capDisconnectionRspWriter<S, emboss_runtime::CompleteState>;
6851 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
6852 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
6853 if self.storage.len() < required_size {
6854 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
6855 }
6856 core::result::Result::Ok(unsafe { L2capDisconnectionRspWriter::new_in_state(self.storage) })
6857 }
6858}
6859
6860impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capDisconnectionRsp<S, emboss_runtime::UncheckedState> {
6861 type Ok = L2capDisconnectionRsp<S, emboss_runtime::OkState>;
6862 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6863 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
6864 core::result::Result::Ok(unsafe { L2capDisconnectionRsp::new_in_state(completed.into_storage()) })
6865 }
6866}
6867
6868impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capDisconnectionRsp<S, emboss_runtime::CompleteState> {
6869 type Ok = L2capDisconnectionRsp<S, emboss_runtime::OkState>;
6870 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6871 core::result::Result::Ok(unsafe { L2capDisconnectionRsp::new_in_state(self.into_storage()) })
6872 }
6873}
6874
6875impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capDisconnectionRsp<S, emboss_runtime::OkState> {
6876 type Ok = L2capDisconnectionRsp<S, emboss_runtime::OkState>;
6877 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6878 core::result::Result::Ok(self)
6879 }
6880}
6881
6882impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capDisconnectionRspWriter<S, emboss_runtime::UncheckedState> {
6883 type Ok = L2capDisconnectionRspWriter<S, emboss_runtime::OkState>;
6884 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6885 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
6886 core::result::Result::Ok(unsafe { L2capDisconnectionRspWriter::new_in_state(completed.into_storage()) })
6887 }
6888}
6889
6890impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capDisconnectionRspWriter<S, emboss_runtime::CompleteState> {
6891 type Ok = L2capDisconnectionRspWriter<S, emboss_runtime::OkState>;
6892 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6893 core::result::Result::Ok(unsafe { L2capDisconnectionRspWriter::new_in_state(self.into_storage()) })
6894 }
6895}
6896
6897impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capDisconnectionRspWriter<S, emboss_runtime::OkState> {
6898 type Ok = L2capDisconnectionRspWriter<S, emboss_runtime::OkState>;
6899 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
6900 core::result::Result::Ok(self)
6901 }
6902}
6903
6904pub mod l2cap_disconnection_rsp {
6905 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capDisconnectionRsp<S, ST>;
6906 pub type ViewMut<S> = super::L2capDisconnectionRspMut<S>;
6907 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capDisconnectionRspWriter<S, ST>;
6908
6909 pub const MIN_SIZE_IN_BYTES: usize = 8;
6910 pub const MAX_SIZE_IN_BYTES: usize = 8;
6911 pub const SIZE_IN_BYTES: usize = 8;
6912}pub struct L2capLeCreditBasedConnectionReq<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
6913 storage: S,
6914 _marker: core::marker::PhantomData<ST>,
6915}
6916
6917impl<S: emboss_runtime::Storage> L2capLeCreditBasedConnectionReq<S, emboss_runtime::UncheckedState> {
6918 pub fn new(storage: S) -> Self {
6919 Self {
6920 storage,
6921 _marker: core::marker::PhantomData,
6922 }
6923 }
6924}
6925
6926impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capLeCreditBasedConnectionReq<S, ST> {
6927 fn clone(&self) -> Self {
6928 Self {
6929 storage: self.storage.clone(),
6930 _marker: core::marker::PhantomData,
6931 }
6932 }
6933}
6934
6935impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capLeCreditBasedConnectionReq<S, ST> {
6936 pub unsafe fn new_in_state(storage: S) -> Self {
6944 Self {
6945 storage,
6946 _marker: core::marker::PhantomData,
6947 }
6948 }
6949 pub fn into_storage(self) -> S {
6950 self.storage
6951 }
6952 pub fn command_header(&self) -> L2capSignalingCommandHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
6953 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6954 let offset = (0) as usize;
6955 let len = (4) as usize;
6956 core::result::Result::Ok((offset, len))
6957 })().unwrap_or((usize::MAX, 0));
6958 let storage = self.storage.slice(offset, len);
6959 unsafe { L2capSignalingCommandHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
6960 }
6961 pub fn spsm(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
6962 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6963 let offset = (4) as usize;
6964 let len = (2) as usize;
6965 core::result::Result::Ok((offset, len))
6966 })().unwrap_or((usize::MAX, 0));
6967 let storage = self.storage.slice(offset, len);
6968 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
6969 }
6970 pub fn source_cid(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
6971 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6972 let offset = (6) as usize;
6973 let len = (2) as usize;
6974 core::result::Result::Ok((offset, len))
6975 })().unwrap_or((usize::MAX, 0));
6976 let storage = self.storage.slice(offset, len);
6977 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
6978 }
6979 pub fn min_mtu(&self) -> emboss_runtime::VirtualField<u64> {
6980 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
6981 core::result::Result::Ok( (23) as u64 )
6982 })();
6983 emboss_runtime::VirtualField::new(value)
6984 }
6985 pub fn mtu(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
6986 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
6987 let offset = (8) as usize;
6988 let len = (2) as usize;
6989 core::result::Result::Ok((offset, len))
6990 })().unwrap_or((usize::MAX, 0));
6991 let storage = self.storage.slice(offset, len);
6992 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
6993 }
6994 pub fn min_mps(&self) -> emboss_runtime::VirtualField<u64> {
6995 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
6996 core::result::Result::Ok( (23) as u64 )
6997 })();
6998 emboss_runtime::VirtualField::new(value)
6999 }
7000 pub fn max_mps(&self) -> emboss_runtime::VirtualField<u64> {
7001 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
7002 core::result::Result::Ok( (65533) as u64 )
7003 })();
7004 emboss_runtime::VirtualField::new(value)
7005 }
7006 pub fn mps(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
7007 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7008 let offset = (10) as usize;
7009 let len = (2) as usize;
7010 core::result::Result::Ok((offset, len))
7011 })().unwrap_or((usize::MAX, 0));
7012 let storage = self.storage.slice(offset, len);
7013 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
7014 }
7015 pub fn max_credit_value(&self) -> emboss_runtime::VirtualField<u64> {
7016 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
7017 core::result::Result::Ok( (65535) as u64 )
7018 })();
7019 emboss_runtime::VirtualField::new(value)
7020 }
7021 pub fn initial_credits(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
7022 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7023 let offset = (12) as usize;
7024 let len = (2) as usize;
7025 core::result::Result::Ok((offset, len))
7026 })().unwrap_or((usize::MAX, 0));
7027 let storage = self.storage.slice(offset, len);
7028 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
7029 }
7030
7031}
7032
7033pub struct L2capLeCreditBasedConnectionReqMut<S: emboss_runtime::MutStorage> {
7034 storage: S,
7035}
7036
7037impl<S: emboss_runtime::MutStorage> L2capLeCreditBasedConnectionReqMut<S> {
7038 pub fn new(storage: S) -> Self {
7039 Self {
7040 storage,
7041 }
7042 }
7043 pub fn into_writer(self) -> L2capLeCreditBasedConnectionReqWriter<S, emboss_runtime::UncheckedState> {
7044 L2capLeCreditBasedConnectionReqWriter::new(self.storage)
7045 }
7046 pub fn as_view(&self) -> L2capLeCreditBasedConnectionReq<S::Sliced<'_>, emboss_runtime::UncheckedState> {
7048 unsafe { L2capLeCreditBasedConnectionReq::new_in_state(self.storage.slice(0, self.storage.len())) }
7049 }
7050 pub fn command_header(&mut self) -> L2capSignalingCommandHeaderMut<S::SlicedMut<'_>> {
7051 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7052 let offset = (0) as usize;
7053 let len = (4) as usize;
7054 core::result::Result::Ok((offset, len))
7055 })().unwrap_or((usize::MAX, 0));
7056 let storage = self.storage.slice_mut(offset, len);
7057 L2capSignalingCommandHeaderMut::<S::SlicedMut<'_>>::new(storage)
7058 }
7059 pub fn spsm(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
7060 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7061 let offset = (4) as usize;
7062 let len = (2) as usize;
7063 core::result::Result::Ok((offset, len))
7064 })().unwrap_or((usize::MAX, 0));
7065 let storage = self.storage.slice_mut(offset, len);
7066 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
7067 }
7068 pub fn source_cid(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
7069 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7070 let offset = (6) as usize;
7071 let len = (2) as usize;
7072 core::result::Result::Ok((offset, len))
7073 })().unwrap_or((usize::MAX, 0));
7074 let storage = self.storage.slice_mut(offset, len);
7075 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
7076 }
7077 pub fn min_mtu(&mut self) -> emboss_runtime::VirtualField<u64> {
7078 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
7079 core::result::Result::Ok( (23) as u64 )
7080 })();
7081 emboss_runtime::VirtualField::new(value)
7082 }
7083 pub fn mtu(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
7084 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7085 let offset = (8) as usize;
7086 let len = (2) as usize;
7087 core::result::Result::Ok((offset, len))
7088 })().unwrap_or((usize::MAX, 0));
7089 let storage = self.storage.slice_mut(offset, len);
7090 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
7091 }
7092 pub fn min_mps(&mut self) -> emboss_runtime::VirtualField<u64> {
7093 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
7094 core::result::Result::Ok( (23) as u64 )
7095 })();
7096 emboss_runtime::VirtualField::new(value)
7097 }
7098 pub fn max_mps(&mut self) -> emboss_runtime::VirtualField<u64> {
7099 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
7100 core::result::Result::Ok( (65533) as u64 )
7101 })();
7102 emboss_runtime::VirtualField::new(value)
7103 }
7104 pub fn mps(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
7105 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7106 let offset = (10) as usize;
7107 let len = (2) as usize;
7108 core::result::Result::Ok((offset, len))
7109 })().unwrap_or((usize::MAX, 0));
7110 let storage = self.storage.slice_mut(offset, len);
7111 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
7112 }
7113 pub fn max_credit_value(&mut self) -> emboss_runtime::VirtualField<u64> {
7114 let value = (|| -> core::result::Result<u64, emboss_runtime::Error> {
7115 core::result::Result::Ok( (65535) as u64 )
7116 })();
7117 emboss_runtime::VirtualField::new(value)
7118 }
7119 pub fn initial_credits(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
7120 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7121 let offset = (12) as usize;
7122 let len = (2) as usize;
7123 core::result::Result::Ok((offset, len))
7124 })().unwrap_or((usize::MAX, 0));
7125 let storage = self.storage.slice_mut(offset, len);
7126 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
7127 }
7128
7129}
7130
7131impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capLeCreditBasedConnectionReqMut<S> {
7132 type Writer = L2capLeCreditBasedConnectionReqWriter<S, emboss_runtime::UncheckedState>;
7133 fn into_writer(self) -> Self::Writer {
7134 L2capLeCreditBasedConnectionReqWriter::new(self.storage)
7135 }
7136}
7137
7138pub struct L2capLeCreditBasedConnectionReqWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
7139 storage: S,
7140 _marker: core::marker::PhantomData<ST>,
7141}
7142
7143impl<S: emboss_runtime::MutStorage> L2capLeCreditBasedConnectionReqWriter<S, emboss_runtime::UncheckedState> {
7144 pub fn new(storage: S) -> Self {
7145 Self {
7146 storage,
7147 _marker: core::marker::PhantomData,
7148 }
7149 }
7150}
7151
7152impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capLeCreditBasedConnectionReqWriter<S, ST> {
7153 pub unsafe fn new_in_state(storage: S) -> Self {
7161 Self {
7162 storage,
7163 _marker: core::marker::PhantomData,
7164 }
7165 }
7166 pub fn into_storage(self) -> S {
7167 self.storage
7168 }
7169 pub fn into_view(self) -> L2capLeCreditBasedConnectionReq<S, ST> {
7171 unsafe { L2capLeCreditBasedConnectionReq::new_in_state(self.storage) }
7172 }
7173 pub fn as_view(&self) -> L2capLeCreditBasedConnectionReq<S::Sliced<'_>, ST> {
7175 unsafe { L2capLeCreditBasedConnectionReq::new_in_state(self.storage.slice(0, self.storage.len())) }
7176 }
7177 pub fn write_spsm(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capLeCreditBasedConnectionReqWriter<S, ST::OnValidMutation> {
7178 let view = self.into_view();
7179 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7180 let offset = (4) as usize;
7181 let len = (2) as usize;
7182 core::result::Result::Ok((offset, len))
7183 })().expect("valid layout in complete state");
7184 let mut storage = view.into_storage();
7185 {
7186 let slice = storage.slice_mut(offset, len);
7187 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
7188 field_view.try_write(val).expect("valid write in complete state");
7189 }
7190 unsafe { L2capLeCreditBasedConnectionReqWriter::new_in_state(storage) }
7191 }
7192 pub fn write_source_cid(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capLeCreditBasedConnectionReqWriter<S, ST::OnValidMutation> {
7193 let view = self.into_view();
7194 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7195 let offset = (6) as usize;
7196 let len = (2) as usize;
7197 core::result::Result::Ok((offset, len))
7198 })().expect("valid layout in complete state");
7199 let mut storage = view.into_storage();
7200 {
7201 let slice = storage.slice_mut(offset, len);
7202 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
7203 field_view.try_write(val).expect("valid write in complete state");
7204 }
7205 unsafe { L2capLeCreditBasedConnectionReqWriter::new_in_state(storage) }
7206 }
7207 pub fn write_mtu(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capLeCreditBasedConnectionReqWriter<S, ST::OnValidMutation> {
7208 let view = self.into_view();
7209 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7210 let offset = (8) as usize;
7211 let len = (2) as usize;
7212 core::result::Result::Ok((offset, len))
7213 })().expect("valid layout in complete state");
7214 let mut storage = view.into_storage();
7215 {
7216 let slice = storage.slice_mut(offset, len);
7217 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
7218 field_view.try_write(val).expect("valid write in complete state");
7219 }
7220 unsafe { L2capLeCreditBasedConnectionReqWriter::new_in_state(storage) }
7221 }
7222 pub fn write_mps(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capLeCreditBasedConnectionReqWriter<S, ST::OnValidMutation> {
7223 let view = self.into_view();
7224 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7225 let offset = (10) as usize;
7226 let len = (2) as usize;
7227 core::result::Result::Ok((offset, len))
7228 })().expect("valid layout in complete state");
7229 let mut storage = view.into_storage();
7230 {
7231 let slice = storage.slice_mut(offset, len);
7232 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
7233 field_view.try_write(val).expect("valid write in complete state");
7234 }
7235 unsafe { L2capLeCreditBasedConnectionReqWriter::new_in_state(storage) }
7236 }
7237 pub fn write_initial_credits(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capLeCreditBasedConnectionReqWriter<S, ST::OnValidMutation> {
7238 let view = self.into_view();
7239 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7240 let offset = (12) as usize;
7241 let len = (2) as usize;
7242 core::result::Result::Ok((offset, len))
7243 })().expect("valid layout in complete state");
7244 let mut storage = view.into_storage();
7245 {
7246 let slice = storage.slice_mut(offset, len);
7247 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
7248 field_view.try_write(val).expect("valid write in complete state");
7249 }
7250 unsafe { L2capLeCreditBasedConnectionReqWriter::new_in_state(storage) }
7251 }
7252
7253}
7254
7255impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capLeCreditBasedConnectionReq<S, ST> {
7256 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
7257 let view = self;
7258 core::result::Result::Ok((14) as usize)
7259 }
7260}
7261
7262impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capLeCreditBasedConnectionReqMut<S> {
7263 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
7264 let view = self.as_view();
7265 <L2capLeCreditBasedConnectionReq<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
7266 }
7267}
7268
7269impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capLeCreditBasedConnectionReqWriter<S, ST> {
7270 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
7271 let view = self.as_view();
7272 <L2capLeCreditBasedConnectionReq<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
7273 }
7274}
7275
7276impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capLeCreditBasedConnectionReq<S, emboss_runtime::UncheckedState> {
7277 type Completed = L2capLeCreditBasedConnectionReq<S, emboss_runtime::CompleteState>;
7278 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
7279 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
7280 if self.storage.len() < required_size {
7281 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
7282 }
7283 core::result::Result::Ok(unsafe { L2capLeCreditBasedConnectionReq::new_in_state(self.storage) })
7284 }
7285}
7286
7287impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capLeCreditBasedConnectionReqWriter<S, emboss_runtime::UncheckedState> {
7288 type Completed = L2capLeCreditBasedConnectionReqWriter<S, emboss_runtime::CompleteState>;
7289 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
7290 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
7291 if self.storage.len() < required_size {
7292 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
7293 }
7294 core::result::Result::Ok(unsafe { L2capLeCreditBasedConnectionReqWriter::new_in_state(self.storage) })
7295 }
7296}
7297
7298impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capLeCreditBasedConnectionReq<S, emboss_runtime::UncheckedState> {
7299 type Ok = L2capLeCreditBasedConnectionReq<S, emboss_runtime::OkState>;
7300 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
7301 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
7302 core::result::Result::Ok(unsafe { L2capLeCreditBasedConnectionReq::new_in_state(completed.into_storage()) })
7303 }
7304}
7305
7306impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capLeCreditBasedConnectionReq<S, emboss_runtime::CompleteState> {
7307 type Ok = L2capLeCreditBasedConnectionReq<S, emboss_runtime::OkState>;
7308 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
7309 core::result::Result::Ok(unsafe { L2capLeCreditBasedConnectionReq::new_in_state(self.into_storage()) })
7310 }
7311}
7312
7313impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capLeCreditBasedConnectionReq<S, emboss_runtime::OkState> {
7314 type Ok = L2capLeCreditBasedConnectionReq<S, emboss_runtime::OkState>;
7315 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
7316 core::result::Result::Ok(self)
7317 }
7318}
7319
7320impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capLeCreditBasedConnectionReqWriter<S, emboss_runtime::UncheckedState> {
7321 type Ok = L2capLeCreditBasedConnectionReqWriter<S, emboss_runtime::OkState>;
7322 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
7323 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
7324 core::result::Result::Ok(unsafe { L2capLeCreditBasedConnectionReqWriter::new_in_state(completed.into_storage()) })
7325 }
7326}
7327
7328impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capLeCreditBasedConnectionReqWriter<S, emboss_runtime::CompleteState> {
7329 type Ok = L2capLeCreditBasedConnectionReqWriter<S, emboss_runtime::OkState>;
7330 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
7331 core::result::Result::Ok(unsafe { L2capLeCreditBasedConnectionReqWriter::new_in_state(self.into_storage()) })
7332 }
7333}
7334
7335impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capLeCreditBasedConnectionReqWriter<S, emboss_runtime::OkState> {
7336 type Ok = L2capLeCreditBasedConnectionReqWriter<S, emboss_runtime::OkState>;
7337 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
7338 core::result::Result::Ok(self)
7339 }
7340}
7341
7342pub mod l2cap_le_credit_based_connection_req {
7343 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capLeCreditBasedConnectionReq<S, ST>;
7344 pub type ViewMut<S> = super::L2capLeCreditBasedConnectionReqMut<S>;
7345 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capLeCreditBasedConnectionReqWriter<S, ST>;
7346
7347 pub const MIN_SIZE_IN_BYTES: usize = 14;
7348 pub const MAX_SIZE_IN_BYTES: usize = 14;
7349 pub const SIZE_IN_BYTES: usize = 14;
7350}pub struct L2capFlowControlCreditInd<S: emboss_runtime::Storage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
7351 storage: S,
7352 _marker: core::marker::PhantomData<ST>,
7353}
7354
7355impl<S: emboss_runtime::Storage> L2capFlowControlCreditInd<S, emboss_runtime::UncheckedState> {
7356 pub fn new(storage: S) -> Self {
7357 Self {
7358 storage,
7359 _marker: core::marker::PhantomData,
7360 }
7361 }
7362}
7363
7364impl<S: emboss_runtime::Storage + core::clone::Clone, ST: emboss_runtime::State> core::clone::Clone for L2capFlowControlCreditInd<S, ST> {
7365 fn clone(&self) -> Self {
7366 Self {
7367 storage: self.storage.clone(),
7368 _marker: core::marker::PhantomData,
7369 }
7370 }
7371}
7372
7373impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> L2capFlowControlCreditInd<S, ST> {
7374 pub unsafe fn new_in_state(storage: S) -> Self {
7382 Self {
7383 storage,
7384 _marker: core::marker::PhantomData,
7385 }
7386 }
7387 pub fn into_storage(self) -> S {
7388 self.storage
7389 }
7390 pub fn command_header(&self) -> L2capSignalingCommandHeader<S::Sliced<'_>, emboss_runtime::UncheckedState> {
7391 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7392 let offset = (0) as usize;
7393 let len = (4) as usize;
7394 core::result::Result::Ok((offset, len))
7395 })().unwrap_or((usize::MAX, 0));
7396 let storage = self.storage.slice(offset, len);
7397 unsafe { L2capSignalingCommandHeader::<S::Sliced<'_>, emboss_runtime::UncheckedState>::new_in_state(storage) }
7398 }
7399 pub fn cid(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
7400 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7401 let offset = (4) as usize;
7402 let len = (2) as usize;
7403 core::result::Result::Ok((offset, len))
7404 })().unwrap_or((usize::MAX, 0));
7405 let storage = self.storage.slice(offset, len);
7406 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
7407 }
7408 pub fn credits(&self) -> UInt<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST> {
7409 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7410 let offset = (6) as usize;
7411 let len = (2) as usize;
7412 core::result::Result::Ok((offset, len))
7413 })().unwrap_or((usize::MAX, 0));
7414 let storage = self.storage.slice(offset, len);
7415 UInt::<16, emboss_runtime::LittleEndian, S::Sliced<'_>, ST>::new(storage)
7416 }
7417
7418}
7419
7420pub struct L2capFlowControlCreditIndMut<S: emboss_runtime::MutStorage> {
7421 storage: S,
7422}
7423
7424impl<S: emboss_runtime::MutStorage> L2capFlowControlCreditIndMut<S> {
7425 pub fn new(storage: S) -> Self {
7426 Self {
7427 storage,
7428 }
7429 }
7430 pub fn into_writer(self) -> L2capFlowControlCreditIndWriter<S, emboss_runtime::UncheckedState> {
7431 L2capFlowControlCreditIndWriter::new(self.storage)
7432 }
7433 pub fn as_view(&self) -> L2capFlowControlCreditInd<S::Sliced<'_>, emboss_runtime::UncheckedState> {
7435 unsafe { L2capFlowControlCreditInd::new_in_state(self.storage.slice(0, self.storage.len())) }
7436 }
7437 pub fn command_header(&mut self) -> L2capSignalingCommandHeaderMut<S::SlicedMut<'_>> {
7438 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7439 let offset = (0) as usize;
7440 let len = (4) as usize;
7441 core::result::Result::Ok((offset, len))
7442 })().unwrap_or((usize::MAX, 0));
7443 let storage = self.storage.slice_mut(offset, len);
7444 L2capSignalingCommandHeaderMut::<S::SlicedMut<'_>>::new(storage)
7445 }
7446 pub fn cid(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
7447 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7448 let offset = (4) as usize;
7449 let len = (2) as usize;
7450 core::result::Result::Ok((offset, len))
7451 })().unwrap_or((usize::MAX, 0));
7452 let storage = self.storage.slice_mut(offset, len);
7453 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
7454 }
7455 pub fn credits(&mut self) -> UInt<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState> {
7456 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7457 let offset = (6) as usize;
7458 let len = (2) as usize;
7459 core::result::Result::Ok((offset, len))
7460 })().unwrap_or((usize::MAX, 0));
7461 let storage = self.storage.slice_mut(offset, len);
7462 UInt::<16, emboss_runtime::LittleEndian, S::SlicedMut<'_>, emboss_runtime::UncheckedState>::new(storage)
7463 }
7464
7465}
7466
7467impl<S: emboss_runtime::MutStorage> emboss_runtime::IntoWriter for L2capFlowControlCreditIndMut<S> {
7468 type Writer = L2capFlowControlCreditIndWriter<S, emboss_runtime::UncheckedState>;
7469 fn into_writer(self) -> Self::Writer {
7470 L2capFlowControlCreditIndWriter::new(self.storage)
7471 }
7472}
7473
7474pub struct L2capFlowControlCreditIndWriter<S: emboss_runtime::MutStorage, ST: emboss_runtime::State = emboss_runtime::UncheckedState> {
7475 storage: S,
7476 _marker: core::marker::PhantomData<ST>,
7477}
7478
7479impl<S: emboss_runtime::MutStorage> L2capFlowControlCreditIndWriter<S, emboss_runtime::UncheckedState> {
7480 pub fn new(storage: S) -> Self {
7481 Self {
7482 storage,
7483 _marker: core::marker::PhantomData,
7484 }
7485 }
7486}
7487
7488impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> L2capFlowControlCreditIndWriter<S, ST> {
7489 pub unsafe fn new_in_state(storage: S) -> Self {
7497 Self {
7498 storage,
7499 _marker: core::marker::PhantomData,
7500 }
7501 }
7502 pub fn into_storage(self) -> S {
7503 self.storage
7504 }
7505 pub fn into_view(self) -> L2capFlowControlCreditInd<S, ST> {
7507 unsafe { L2capFlowControlCreditInd::new_in_state(self.storage) }
7508 }
7509 pub fn as_view(&self) -> L2capFlowControlCreditInd<S::Sliced<'_>, ST> {
7511 unsafe { L2capFlowControlCreditInd::new_in_state(self.storage.slice(0, self.storage.len())) }
7512 }
7513 pub fn write_cid(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capFlowControlCreditIndWriter<S, ST::OnValidMutation> {
7514 let view = self.into_view();
7515 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7516 let offset = (4) as usize;
7517 let len = (2) as usize;
7518 core::result::Result::Ok((offset, len))
7519 })().expect("valid layout in complete state");
7520 let mut storage = view.into_storage();
7521 {
7522 let slice = storage.slice_mut(offset, len);
7523 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
7524 field_view.try_write(val).expect("valid write in complete state");
7525 }
7526 unsafe { L2capFlowControlCreditIndWriter::new_in_state(storage) }
7527 }
7528 pub fn write_credits(self, val: <emboss_runtime::SizeSelector<16> as emboss_runtime::SmallestUInt>::T) -> L2capFlowControlCreditIndWriter<S, ST::OnValidMutation> {
7529 let view = self.into_view();
7530 let (offset, len) = (|| -> core::result::Result<(usize, usize), emboss_runtime::Error> {
7531 let offset = (6) as usize;
7532 let len = (2) as usize;
7533 core::result::Result::Ok((offset, len))
7534 })().expect("valid layout in complete state");
7535 let mut storage = view.into_storage();
7536 {
7537 let slice = storage.slice_mut(offset, len);
7538 let mut field_view = emboss_runtime::UInt::<16, emboss_runtime::LittleEndian, _>::new(slice);
7539 field_view.try_write(val).expect("valid write in complete state");
7540 }
7541 unsafe { L2capFlowControlCreditIndWriter::new_in_state(storage) }
7542 }
7543
7544}
7545
7546impl<S: emboss_runtime::Storage, ST: emboss_runtime::State> emboss_runtime::View for L2capFlowControlCreditInd<S, ST> {
7547 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
7548 let view = self;
7549 core::result::Result::Ok((8) as usize)
7550 }
7551}
7552
7553impl<S: emboss_runtime::MutStorage> emboss_runtime::View for L2capFlowControlCreditIndMut<S> {
7554 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
7555 let view = self.as_view();
7556 <L2capFlowControlCreditInd<S::Sliced<'_>, emboss_runtime::UncheckedState> as emboss_runtime::View>::size_in_bytes(&view)
7557 }
7558}
7559
7560impl<S: emboss_runtime::MutStorage, ST: emboss_runtime::State> emboss_runtime::View for L2capFlowControlCreditIndWriter<S, ST> {
7561 fn size_in_bytes(&self) -> core::result::Result<usize, emboss_runtime::Error> {
7562 let view = self.as_view();
7563 <L2capFlowControlCreditInd<S::Sliced<'_>, ST> as emboss_runtime::View>::size_in_bytes(&view)
7564 }
7565}
7566
7567impl<S: emboss_runtime::Storage> emboss_runtime::CheckComplete for L2capFlowControlCreditInd<S, emboss_runtime::UncheckedState> {
7568 type Completed = L2capFlowControlCreditInd<S, emboss_runtime::CompleteState>;
7569 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
7570 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
7571 if self.storage.len() < required_size {
7572 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
7573 }
7574 core::result::Result::Ok(unsafe { L2capFlowControlCreditInd::new_in_state(self.storage) })
7575 }
7576}
7577
7578impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckComplete for L2capFlowControlCreditIndWriter<S, emboss_runtime::UncheckedState> {
7579 type Completed = L2capFlowControlCreditIndWriter<S, emboss_runtime::CompleteState>;
7580 fn check_complete(self) -> core::result::Result<Self::Completed, emboss_runtime::Error> {
7581 let required_size = <Self as emboss_runtime::View>::size_in_bytes(&self)?;
7582 if self.storage.len() < required_size {
7583 return core::result::Result::Err(emboss_runtime::Error::OutOfBounds);
7584 }
7585 core::result::Result::Ok(unsafe { L2capFlowControlCreditIndWriter::new_in_state(self.storage) })
7586 }
7587}
7588
7589impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capFlowControlCreditInd<S, emboss_runtime::UncheckedState> {
7590 type Ok = L2capFlowControlCreditInd<S, emboss_runtime::OkState>;
7591 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
7592 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
7593 core::result::Result::Ok(unsafe { L2capFlowControlCreditInd::new_in_state(completed.into_storage()) })
7594 }
7595}
7596
7597impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capFlowControlCreditInd<S, emboss_runtime::CompleteState> {
7598 type Ok = L2capFlowControlCreditInd<S, emboss_runtime::OkState>;
7599 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
7600 core::result::Result::Ok(unsafe { L2capFlowControlCreditInd::new_in_state(self.into_storage()) })
7601 }
7602}
7603
7604impl<S: emboss_runtime::Storage> emboss_runtime::CheckOk for L2capFlowControlCreditInd<S, emboss_runtime::OkState> {
7605 type Ok = L2capFlowControlCreditInd<S, emboss_runtime::OkState>;
7606 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
7607 core::result::Result::Ok(self)
7608 }
7609}
7610
7611impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capFlowControlCreditIndWriter<S, emboss_runtime::UncheckedState> {
7612 type Ok = L2capFlowControlCreditIndWriter<S, emboss_runtime::OkState>;
7613 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
7614 let completed = emboss_runtime::CheckComplete::check_complete(self)?;
7615 core::result::Result::Ok(unsafe { L2capFlowControlCreditIndWriter::new_in_state(completed.into_storage()) })
7616 }
7617}
7618
7619impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capFlowControlCreditIndWriter<S, emboss_runtime::CompleteState> {
7620 type Ok = L2capFlowControlCreditIndWriter<S, emboss_runtime::OkState>;
7621 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
7622 core::result::Result::Ok(unsafe { L2capFlowControlCreditIndWriter::new_in_state(self.into_storage()) })
7623 }
7624}
7625
7626impl<S: emboss_runtime::MutStorage> emboss_runtime::CheckOk for L2capFlowControlCreditIndWriter<S, emboss_runtime::OkState> {
7627 type Ok = L2capFlowControlCreditIndWriter<S, emboss_runtime::OkState>;
7628 fn check_ok(self) -> core::result::Result<Self::Ok, emboss_runtime::Error> {
7629 core::result::Result::Ok(self)
7630 }
7631}
7632
7633pub mod l2cap_flow_control_credit_ind {
7634 pub type View<S, ST = emboss_runtime::UncheckedState> = super::L2capFlowControlCreditInd<S, ST>;
7635 pub type ViewMut<S> = super::L2capFlowControlCreditIndMut<S>;
7636 pub type Writer<S, ST = emboss_runtime::UncheckedState> = super::L2capFlowControlCreditIndWriter<S, ST>;
7637
7638 pub const MIN_SIZE_IN_BYTES: usize = 8;
7639 pub const MAX_SIZE_IN_BYTES: usize = 8;
7640 pub const SIZE_IN_BYTES: usize = 8;
7641}