pub struct Fixed(/* private fields */);Expand description
A signed 24.8 fixed-point number used in the wayland protocol.
This is a signed decimal type which offers a sign bit, 23 bits of integer precision and 8 bits of decimal precision.
§Arithmetic operations
This type implements all of the usual arithmetic operations for numbers. On overflow, they behave like the standard library operations except that multiplication and division always use wrapping semantics.
Implementations§
Source§impl Fixed
impl Fixed
Sourcepub const NEGATIVE_EPSILON: Self
pub const NEGATIVE_EPSILON: Self
The largest negative Fixed.
Sourcepub const fn from_wire(val: i32) -> Self
pub const fn from_wire(val: i32) -> Self
Creates a Fixed from the raw bits that appear in the wire protocol.
Examples found in repository?
340 unsafe fn handle_event(
341 &self,
342 queue: &Queue,
343 data: *mut u8,
344 slf: &UntypedBorrowedProxy,
345 opcode: u32,
346 args: *mut wl_argument,
347 ) {
348 // SAFETY: This function requires that slf has the interface INTERFACE
349 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletPadRingV2Ref>(slf) };
350 match opcode {
351 0 => {
352 // SAFETY: INTERFACE requires that there are 1 arguments
353 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
354 // SAFETY: - INTERFACE requires that args[0] contains a uint
355 let arg0 = unsafe { ZwpTabletPadRingV2Source(args[0].u) };
356 self.0.source(slf, arg0);
357 }
358 1 => {
359 // SAFETY: INTERFACE requires that there are 1 arguments
360 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
361 // SAFETY: - INTERFACE requires that args[0] contains a fixed
362 let arg0 = unsafe { Fixed::from_wire(args[0].f) };
363 self.0.angle(slf, arg0);
364 }
365 2 => {
366 self.0.stop(slf);
367 }
368 3 => {
369 // SAFETY: INTERFACE requires that there are 1 arguments
370 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
371 // SAFETY: - INTERFACE requires that args[0] contains a uint
372 let arg0 = unsafe { args[0].u };
373 self.0.frame(slf, arg0);
374 }
375 _ => {
376 invalid_opcode("zwp_tablet_pad_ring_v2", opcode);
377 }
378 }
379 }More examples
357 unsafe fn handle_event(
358 &self,
359 queue: &Queue,
360 data: *mut u8,
361 slf: &UntypedBorrowedProxy,
362 opcode: u32,
363 args: *mut wl_argument,
364 ) {
365 // SAFETY: This function requires that slf has the interface INTERFACE
366 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletPadRingV2Ref>(slf) };
367 // SAFETY: This function requires that data is `&mut T` where `T`
368 // has the type id returned by `Self::mutable_type`, i.e.,
369 // `T = H::Data`.
370 let data: &mut H::Data = unsafe { &mut *data.cast() };
371 match opcode {
372 0 => {
373 // SAFETY: INTERFACE requires that there are 1 arguments
374 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
375 // SAFETY: - INTERFACE requires that args[0] contains a uint
376 let arg0 = unsafe { ZwpTabletPadRingV2Source(args[0].u) };
377 self.0.source(data, slf, arg0);
378 }
379 1 => {
380 // SAFETY: INTERFACE requires that there are 1 arguments
381 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
382 // SAFETY: - INTERFACE requires that args[0] contains a fixed
383 let arg0 = unsafe { Fixed::from_wire(args[0].f) };
384 self.0.angle(data, slf, arg0);
385 }
386 2 => {
387 self.0.stop(data, slf);
388 }
389 3 => {
390 // SAFETY: INTERFACE requires that there are 1 arguments
391 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
392 // SAFETY: - INTERFACE requires that args[0] contains a uint
393 let arg0 = unsafe { args[0].u };
394 self.0.frame(data, slf, arg0);
395 }
396 _ => {
397 invalid_opcode("zwp_tablet_pad_ring_v2", opcode);
398 }
399 }
400 }419 unsafe fn handle_event(
420 &self,
421 queue: &Queue,
422 data: *mut u8,
423 slf: &UntypedBorrowedProxy,
424 opcode: u32,
425 args: *mut wl_argument,
426 ) {
427 // SAFETY: This function requires that slf has the interface INTERFACE
428 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlTouchRef>(slf) };
429 match opcode {
430 0 => {
431 // SAFETY: INTERFACE requires that there are 6 arguments
432 let args = unsafe { &*args.cast::<[wl_argument; 6]>() };
433 // SAFETY: - INTERFACE requires that args[0] contains a uint
434 let arg0 = unsafe { args[0].u };
435 // SAFETY: - INTERFACE requires that args[1] contains a uint
436 let arg1 = unsafe { args[1].u };
437 // SAFETY: - INTERFACE requires that args[2] contains an object
438 let arg2 = unsafe {
439 if let Some(p) = NonNull::new(args[2].o.cast()) {
440 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
441 } else {
442 None
443 }
444 };
445 // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
446 let arg2 = arg2.as_ref().map(|arg2| unsafe {
447 proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg2)
448 });
449 // SAFETY: - INTERFACE requires that args[3] contains an int
450 let arg3 = unsafe { args[3].i };
451 // SAFETY: - INTERFACE requires that args[4] contains a fixed
452 let arg4 = unsafe { Fixed::from_wire(args[4].f) };
453 // SAFETY: - INTERFACE requires that args[5] contains a fixed
454 let arg5 = unsafe { Fixed::from_wire(args[5].f) };
455 self.0.down(slf, arg0, arg1, arg2, arg3, arg4, arg5);
456 }
457 1 => {
458 // SAFETY: INTERFACE requires that there are 3 arguments
459 let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
460 // SAFETY: - INTERFACE requires that args[0] contains a uint
461 let arg0 = unsafe { args[0].u };
462 // SAFETY: - INTERFACE requires that args[1] contains a uint
463 let arg1 = unsafe { args[1].u };
464 // SAFETY: - INTERFACE requires that args[2] contains an int
465 let arg2 = unsafe { args[2].i };
466 self.0.up(slf, arg0, arg1, arg2);
467 }
468 2 => {
469 // SAFETY: INTERFACE requires that there are 4 arguments
470 let args = unsafe { &*args.cast::<[wl_argument; 4]>() };
471 // SAFETY: - INTERFACE requires that args[0] contains a uint
472 let arg0 = unsafe { args[0].u };
473 // SAFETY: - INTERFACE requires that args[1] contains an int
474 let arg1 = unsafe { args[1].i };
475 // SAFETY: - INTERFACE requires that args[2] contains a fixed
476 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
477 // SAFETY: - INTERFACE requires that args[3] contains a fixed
478 let arg3 = unsafe { Fixed::from_wire(args[3].f) };
479 self.0.motion(slf, arg0, arg1, arg2, arg3);
480 }
481 3 => {
482 self.0.frame(slf);
483 }
484 4 => {
485 self.0.cancel(slf);
486 }
487 5 => {
488 // SAFETY: INTERFACE requires that there are 3 arguments
489 let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
490 // SAFETY: - INTERFACE requires that args[0] contains an int
491 let arg0 = unsafe { args[0].i };
492 // SAFETY: - INTERFACE requires that args[1] contains a fixed
493 let arg1 = unsafe { Fixed::from_wire(args[1].f) };
494 // SAFETY: - INTERFACE requires that args[2] contains a fixed
495 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
496 self.0.shape(slf, arg0, arg1, arg2);
497 }
498 6 => {
499 // SAFETY: INTERFACE requires that there are 2 arguments
500 let args = unsafe { &*args.cast::<[wl_argument; 2]>() };
501 // SAFETY: - INTERFACE requires that args[0] contains an int
502 let arg0 = unsafe { args[0].i };
503 // SAFETY: - INTERFACE requires that args[1] contains a fixed
504 let arg1 = unsafe { Fixed::from_wire(args[1].f) };
505 self.0.orientation(slf, arg0, arg1);
506 }
507 _ => {
508 invalid_opcode("wl_touch", opcode);
509 }
510 }
511 }447 unsafe fn handle_event(
448 &self,
449 queue: &Queue,
450 data: *mut u8,
451 slf: &UntypedBorrowedProxy,
452 opcode: u32,
453 args: *mut wl_argument,
454 ) {
455 // SAFETY: This function requires that slf has the interface INTERFACE
456 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlTouchRef>(slf) };
457 // SAFETY: This function requires that data is `&mut T` where `T`
458 // has the type id returned by `Self::mutable_type`, i.e.,
459 // `T = H::Data`.
460 let data: &mut H::Data = unsafe { &mut *data.cast() };
461 match opcode {
462 0 => {
463 // SAFETY: INTERFACE requires that there are 6 arguments
464 let args = unsafe { &*args.cast::<[wl_argument; 6]>() };
465 // SAFETY: - INTERFACE requires that args[0] contains a uint
466 let arg0 = unsafe { args[0].u };
467 // SAFETY: - INTERFACE requires that args[1] contains a uint
468 let arg1 = unsafe { args[1].u };
469 // SAFETY: - INTERFACE requires that args[2] contains an object
470 let arg2 = unsafe {
471 if let Some(p) = NonNull::new(args[2].o.cast()) {
472 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
473 } else {
474 None
475 }
476 };
477 // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
478 let arg2 = arg2.as_ref().map(|arg2| unsafe {
479 proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg2)
480 });
481 // SAFETY: - INTERFACE requires that args[3] contains an int
482 let arg3 = unsafe { args[3].i };
483 // SAFETY: - INTERFACE requires that args[4] contains a fixed
484 let arg4 = unsafe { Fixed::from_wire(args[4].f) };
485 // SAFETY: - INTERFACE requires that args[5] contains a fixed
486 let arg5 = unsafe { Fixed::from_wire(args[5].f) };
487 self.0.down(data, slf, arg0, arg1, arg2, arg3, arg4, arg5);
488 }
489 1 => {
490 // SAFETY: INTERFACE requires that there are 3 arguments
491 let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
492 // SAFETY: - INTERFACE requires that args[0] contains a uint
493 let arg0 = unsafe { args[0].u };
494 // SAFETY: - INTERFACE requires that args[1] contains a uint
495 let arg1 = unsafe { args[1].u };
496 // SAFETY: - INTERFACE requires that args[2] contains an int
497 let arg2 = unsafe { args[2].i };
498 self.0.up(data, slf, arg0, arg1, arg2);
499 }
500 2 => {
501 // SAFETY: INTERFACE requires that there are 4 arguments
502 let args = unsafe { &*args.cast::<[wl_argument; 4]>() };
503 // SAFETY: - INTERFACE requires that args[0] contains a uint
504 let arg0 = unsafe { args[0].u };
505 // SAFETY: - INTERFACE requires that args[1] contains an int
506 let arg1 = unsafe { args[1].i };
507 // SAFETY: - INTERFACE requires that args[2] contains a fixed
508 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
509 // SAFETY: - INTERFACE requires that args[3] contains a fixed
510 let arg3 = unsafe { Fixed::from_wire(args[3].f) };
511 self.0.motion(data, slf, arg0, arg1, arg2, arg3);
512 }
513 3 => {
514 self.0.frame(data, slf);
515 }
516 4 => {
517 self.0.cancel(data, slf);
518 }
519 5 => {
520 // SAFETY: INTERFACE requires that there are 3 arguments
521 let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
522 // SAFETY: - INTERFACE requires that args[0] contains an int
523 let arg0 = unsafe { args[0].i };
524 // SAFETY: - INTERFACE requires that args[1] contains a fixed
525 let arg1 = unsafe { Fixed::from_wire(args[1].f) };
526 // SAFETY: - INTERFACE requires that args[2] contains a fixed
527 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
528 self.0.shape(data, slf, arg0, arg1, arg2);
529 }
530 6 => {
531 // SAFETY: INTERFACE requires that there are 2 arguments
532 let args = unsafe { &*args.cast::<[wl_argument; 2]>() };
533 // SAFETY: - INTERFACE requires that args[0] contains an int
534 let arg0 = unsafe { args[0].i };
535 // SAFETY: - INTERFACE requires that args[1] contains a fixed
536 let arg1 = unsafe { Fixed::from_wire(args[1].f) };
537 self.0.orientation(data, slf, arg0, arg1);
538 }
539 _ => {
540 invalid_opcode("wl_touch", opcode);
541 }
542 }
543 }490 unsafe fn handle_event(
491 &self,
492 queue: &Queue,
493 data: *mut u8,
494 slf: &UntypedBorrowedProxy,
495 opcode: u32,
496 args: *mut wl_argument,
497 ) {
498 // SAFETY: This function requires that slf has the interface INTERFACE
499 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlDataDeviceRef>(slf) };
500 match opcode {
501 0 => {
502 // SAFETY: INTERFACE requires that there are 1 arguments
503 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
504 // SAFETY: - INTERFACE requires that args[0] contains an object
505 // - ownership is transferred to this function
506 // - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
507 let arg0 = unsafe {
508 UntypedOwnedProxy::from_plain_wl_proxy(
509 queue,
510 NonNull::new_unchecked(args[0].o.cast()),
511 WlDataOffer::WL_INTERFACE,
512 )
513 };
514 // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
515 let arg0 = unsafe { proxy::low_level::from_untyped_owned::<WlDataOffer>(arg0) };
516 self.0.data_offer(slf, arg0);
517 }
518 1 => {
519 // SAFETY: INTERFACE requires that there are 5 arguments
520 let args = unsafe { &*args.cast::<[wl_argument; 5]>() };
521 // SAFETY: - INTERFACE requires that args[0] contains a uint
522 let arg0 = unsafe { args[0].u };
523 // SAFETY: - INTERFACE requires that args[1] contains an object
524 let arg1 = unsafe {
525 if let Some(p) = NonNull::new(args[1].o.cast()) {
526 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
527 } else {
528 None
529 }
530 };
531 // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
532 let arg1 = arg1.as_ref().map(|arg1| unsafe {
533 proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg1)
534 });
535 // SAFETY: - INTERFACE requires that args[2] contains a fixed
536 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
537 // SAFETY: - INTERFACE requires that args[3] contains a fixed
538 let arg3 = unsafe { Fixed::from_wire(args[3].f) };
539 // SAFETY: - INTERFACE requires that args[4] contains an object
540 let arg4 = unsafe {
541 if let Some(p) = NonNull::new(args[4].o.cast()) {
542 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
543 } else {
544 None
545 }
546 };
547 // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
548 let arg4 = arg4.as_ref().map(|arg4| unsafe {
549 proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg4)
550 });
551 self.0.enter(slf, arg0, arg1, arg2, arg3, arg4);
552 }
553 2 => {
554 self.0.leave(slf);
555 }
556 3 => {
557 // SAFETY: INTERFACE requires that there are 3 arguments
558 let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
559 // SAFETY: - INTERFACE requires that args[0] contains a uint
560 let arg0 = unsafe { args[0].u };
561 // SAFETY: - INTERFACE requires that args[1] contains a fixed
562 let arg1 = unsafe { Fixed::from_wire(args[1].f) };
563 // SAFETY: - INTERFACE requires that args[2] contains a fixed
564 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
565 self.0.motion(slf, arg0, arg1, arg2);
566 }
567 4 => {
568 self.0.drop(slf);
569 }
570 5 => {
571 // SAFETY: INTERFACE requires that there are 1 arguments
572 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
573 // SAFETY: - INTERFACE requires that args[0] contains an object
574 let arg0 = unsafe {
575 if let Some(p) = NonNull::new(args[0].o.cast()) {
576 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
577 } else {
578 None
579 }
580 };
581 // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
582 let arg0 = arg0.as_ref().map(|arg0| unsafe {
583 proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg0)
584 });
585 self.0.selection(slf, arg0);
586 }
587 _ => {
588 invalid_opcode("wl_data_device", opcode);
589 }
590 }
591 }515 unsafe fn handle_event(
516 &self,
517 queue: &Queue,
518 data: *mut u8,
519 slf: &UntypedBorrowedProxy,
520 opcode: u32,
521 args: *mut wl_argument,
522 ) {
523 // SAFETY: This function requires that slf has the interface INTERFACE
524 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlDataDeviceRef>(slf) };
525 // SAFETY: This function requires that data is `&mut T` where `T`
526 // has the type id returned by `Self::mutable_type`, i.e.,
527 // `T = H::Data`.
528 let data: &mut H::Data = unsafe { &mut *data.cast() };
529 match opcode {
530 0 => {
531 // SAFETY: INTERFACE requires that there are 1 arguments
532 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
533 // SAFETY: - INTERFACE requires that args[0] contains an object
534 // - ownership is transferred to this function
535 // - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
536 let arg0 = unsafe {
537 UntypedOwnedProxy::from_plain_wl_proxy(
538 queue,
539 NonNull::new_unchecked(args[0].o.cast()),
540 WlDataOffer::WL_INTERFACE,
541 )
542 };
543 // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
544 let arg0 = unsafe { proxy::low_level::from_untyped_owned::<WlDataOffer>(arg0) };
545 self.0.data_offer(data, slf, arg0);
546 }
547 1 => {
548 // SAFETY: INTERFACE requires that there are 5 arguments
549 let args = unsafe { &*args.cast::<[wl_argument; 5]>() };
550 // SAFETY: - INTERFACE requires that args[0] contains a uint
551 let arg0 = unsafe { args[0].u };
552 // SAFETY: - INTERFACE requires that args[1] contains an object
553 let arg1 = unsafe {
554 if let Some(p) = NonNull::new(args[1].o.cast()) {
555 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
556 } else {
557 None
558 }
559 };
560 // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
561 let arg1 = arg1.as_ref().map(|arg1| unsafe {
562 proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg1)
563 });
564 // SAFETY: - INTERFACE requires that args[2] contains a fixed
565 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
566 // SAFETY: - INTERFACE requires that args[3] contains a fixed
567 let arg3 = unsafe { Fixed::from_wire(args[3].f) };
568 // SAFETY: - INTERFACE requires that args[4] contains an object
569 let arg4 = unsafe {
570 if let Some(p) = NonNull::new(args[4].o.cast()) {
571 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
572 } else {
573 None
574 }
575 };
576 // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
577 let arg4 = arg4.as_ref().map(|arg4| unsafe {
578 proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg4)
579 });
580 self.0.enter(data, slf, arg0, arg1, arg2, arg3, arg4);
581 }
582 2 => {
583 self.0.leave(data, slf);
584 }
585 3 => {
586 // SAFETY: INTERFACE requires that there are 3 arguments
587 let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
588 // SAFETY: - INTERFACE requires that args[0] contains a uint
589 let arg0 = unsafe { args[0].u };
590 // SAFETY: - INTERFACE requires that args[1] contains a fixed
591 let arg1 = unsafe { Fixed::from_wire(args[1].f) };
592 // SAFETY: - INTERFACE requires that args[2] contains a fixed
593 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
594 self.0.motion(data, slf, arg0, arg1, arg2);
595 }
596 4 => {
597 self.0.drop(data, slf);
598 }
599 5 => {
600 // SAFETY: INTERFACE requires that there are 1 arguments
601 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
602 // SAFETY: - INTERFACE requires that args[0] contains an object
603 let arg0 = unsafe {
604 if let Some(p) = NonNull::new(args[0].o.cast()) {
605 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
606 } else {
607 None
608 }
609 };
610 // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
611 let arg0 = arg0.as_ref().map(|arg0| unsafe {
612 proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg0)
613 });
614 self.0.selection(data, slf, arg0);
615 }
616 _ => {
617 invalid_opcode("wl_data_device", opcode);
618 }
619 }
620 }Sourcepub const fn to_wire(self) -> i32
pub const fn to_wire(self) -> i32
Converts this Fixed to the bits that should be set in the wire protocol.
Examples found in repository?
228 pub fn set_source(&self, x: Fixed, y: Fixed, width: Fixed, height: Fixed) {
229 let (arg0, arg1, arg2, arg3) = (x, y, width, height);
230 let mut args = [
231 wl_argument { f: arg0.to_wire() },
232 wl_argument { f: arg1.to_wire() },
233 wl_argument { f: arg2.to_wire() },
234 wl_argument { f: arg3.to_wire() },
235 ];
236 // SAFETY: - self.proxy has the interface INTERFACE
237 // - 1 < INTERFACE.method_count = 3
238 // - the request signature is `ffff`
239 unsafe {
240 self.proxy.send_request(1, &mut args);
241 }
242 }More examples
228 pub fn set_source(&self, x: Fixed, y: Fixed, width: Fixed, height: Fixed) {
229 let (arg0, arg1, arg2, arg3) = (x, y, width, height);
230 let mut args = [
231 wl_argument { f: arg0.to_wire() },
232 wl_argument { f: arg1.to_wire() },
233 wl_argument { f: arg2.to_wire() },
234 wl_argument { f: arg3.to_wire() },
235 ];
236 // SAFETY: - self.proxy has the interface INTERFACE
237 // - 1 < INTERFACE.method_count = 3
238 // - the request signature is `ffff`
239 unsafe {
240 self.proxy.send_request(1, &mut args);
241 }
242 }Sourcepub const fn to_f32_lossy(self) -> f32
pub const fn to_f32_lossy(self) -> f32
Sourcepub const fn from_f64_lossy(val: f64) -> Self
pub const fn from_f64_lossy(val: f64) -> Self
Creates a Fixed from an f64.
If the value cannot be represented exactly, the behavior is as when an f64 is cast to an
integer. That is
- Values are rounded towards 0.
NaNreturnsFixed::ZERO.- Values larger than the maximum return
Fixed::MAX. - Values smaller than the minimum return
Fixed::MIN.
Sourcepub const fn from_f32_lossy(val: f32) -> Self
pub const fn from_f32_lossy(val: f32) -> Self
Creates a Fixed from an f32.
The conversion behavior is the same as for Fixed::from_f64_lossy.
Sourcepub const fn from_i32_saturating(val: i32) -> Self
pub const fn from_i32_saturating(val: i32) -> Self
Creates a Fixed from an i32.
Values outside of the representable range are clamped to Fixed::MIN and Fixed::MAX.
Sourcepub const fn from_i64_saturating(val: i64) -> Self
pub const fn from_i64_saturating(val: i64) -> Self
Creates a Fixed from an i64.
Values outside of the representable range are clamped to Fixed::MIN and Fixed::MAX.
Sourcepub const fn to_i32_round_towards_nearest(self) -> i32
pub const fn to_i32_round_towards_nearest(self) -> i32
Converts this Fixed to an i32.
The conversion rounds towards the nearest integer and half-way away from 0.
Sourcepub const fn to_i32_round_towards_zero(self) -> i32
pub const fn to_i32_round_towards_zero(self) -> i32
Converts this Fixed to an i32.
The conversion rounds towards zero.
Sourcepub const fn to_i32_floor(self) -> i32
pub const fn to_i32_floor(self) -> i32
Converts this Fixed to an i32.
The conversion rounds towards minus infinity.
Sourcepub const fn to_i32_ceil(self) -> i32
pub const fn to_i32_ceil(self) -> i32
Converts this Fixed to an i32.
The conversion rounds towards infinity.
Trait Implementations§
Source§impl AddAssign for Fixed
impl AddAssign for Fixed
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl BitAndAssign for Fixed
impl BitAndAssign for Fixed
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&= operation. Read moreSource§impl BitOrAssign for Fixed
impl BitOrAssign for Fixed
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|= operation. Read moreSource§impl BitXorAssign for Fixed
impl BitXorAssign for Fixed
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^= operation. Read moreSource§impl DivAssign for Fixed
impl DivAssign for Fixed
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moreSource§impl MulAssign for Fixed
impl MulAssign for Fixed
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreSource§impl Ord for Fixed
impl Ord for Fixed
Source§impl PartialOrd for Fixed
impl PartialOrd for Fixed
Source§impl RemAssign for Fixed
impl RemAssign for Fixed
Source§fn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
%= operation. Read moreSource§impl ShlAssign<&i128> for Fixed
impl ShlAssign<&i128> for Fixed
Source§fn shl_assign(&mut self, rhs: &i128)
fn shl_assign(&mut self, rhs: &i128)
<<= operation. Read moreSource§impl ShlAssign<&i16> for Fixed
impl ShlAssign<&i16> for Fixed
Source§fn shl_assign(&mut self, rhs: &i16)
fn shl_assign(&mut self, rhs: &i16)
<<= operation. Read moreSource§impl ShlAssign<&i32> for Fixed
impl ShlAssign<&i32> for Fixed
Source§fn shl_assign(&mut self, rhs: &i32)
fn shl_assign(&mut self, rhs: &i32)
<<= operation. Read moreSource§impl ShlAssign<&i64> for Fixed
impl ShlAssign<&i64> for Fixed
Source§fn shl_assign(&mut self, rhs: &i64)
fn shl_assign(&mut self, rhs: &i64)
<<= operation. Read moreSource§impl ShlAssign<&i8> for Fixed
impl ShlAssign<&i8> for Fixed
Source§fn shl_assign(&mut self, rhs: &i8)
fn shl_assign(&mut self, rhs: &i8)
<<= operation. Read moreSource§impl ShlAssign<&isize> for Fixed
impl ShlAssign<&isize> for Fixed
Source§fn shl_assign(&mut self, rhs: &isize)
fn shl_assign(&mut self, rhs: &isize)
<<= operation. Read moreSource§impl ShlAssign<&u128> for Fixed
impl ShlAssign<&u128> for Fixed
Source§fn shl_assign(&mut self, rhs: &u128)
fn shl_assign(&mut self, rhs: &u128)
<<= operation. Read moreSource§impl ShlAssign<&u16> for Fixed
impl ShlAssign<&u16> for Fixed
Source§fn shl_assign(&mut self, rhs: &u16)
fn shl_assign(&mut self, rhs: &u16)
<<= operation. Read moreSource§impl ShlAssign<&u32> for Fixed
impl ShlAssign<&u32> for Fixed
Source§fn shl_assign(&mut self, rhs: &u32)
fn shl_assign(&mut self, rhs: &u32)
<<= operation. Read moreSource§impl ShlAssign<&u64> for Fixed
impl ShlAssign<&u64> for Fixed
Source§fn shl_assign(&mut self, rhs: &u64)
fn shl_assign(&mut self, rhs: &u64)
<<= operation. Read moreSource§impl ShlAssign<&u8> for Fixed
impl ShlAssign<&u8> for Fixed
Source§fn shl_assign(&mut self, rhs: &u8)
fn shl_assign(&mut self, rhs: &u8)
<<= operation. Read moreSource§impl ShlAssign<&usize> for Fixed
impl ShlAssign<&usize> for Fixed
Source§fn shl_assign(&mut self, rhs: &usize)
fn shl_assign(&mut self, rhs: &usize)
<<= operation. Read moreSource§impl ShlAssign<i128> for Fixed
impl ShlAssign<i128> for Fixed
Source§fn shl_assign(&mut self, rhs: i128)
fn shl_assign(&mut self, rhs: i128)
<<= operation. Read moreSource§impl ShlAssign<i16> for Fixed
impl ShlAssign<i16> for Fixed
Source§fn shl_assign(&mut self, rhs: i16)
fn shl_assign(&mut self, rhs: i16)
<<= operation. Read moreSource§impl ShlAssign<i32> for Fixed
impl ShlAssign<i32> for Fixed
Source§fn shl_assign(&mut self, rhs: i32)
fn shl_assign(&mut self, rhs: i32)
<<= operation. Read moreSource§impl ShlAssign<i64> for Fixed
impl ShlAssign<i64> for Fixed
Source§fn shl_assign(&mut self, rhs: i64)
fn shl_assign(&mut self, rhs: i64)
<<= operation. Read moreSource§impl ShlAssign<i8> for Fixed
impl ShlAssign<i8> for Fixed
Source§fn shl_assign(&mut self, rhs: i8)
fn shl_assign(&mut self, rhs: i8)
<<= operation. Read moreSource§impl ShlAssign<isize> for Fixed
impl ShlAssign<isize> for Fixed
Source§fn shl_assign(&mut self, rhs: isize)
fn shl_assign(&mut self, rhs: isize)
<<= operation. Read moreSource§impl ShlAssign<u128> for Fixed
impl ShlAssign<u128> for Fixed
Source§fn shl_assign(&mut self, rhs: u128)
fn shl_assign(&mut self, rhs: u128)
<<= operation. Read moreSource§impl ShlAssign<u16> for Fixed
impl ShlAssign<u16> for Fixed
Source§fn shl_assign(&mut self, rhs: u16)
fn shl_assign(&mut self, rhs: u16)
<<= operation. Read moreSource§impl ShlAssign<u32> for Fixed
impl ShlAssign<u32> for Fixed
Source§fn shl_assign(&mut self, rhs: u32)
fn shl_assign(&mut self, rhs: u32)
<<= operation. Read moreSource§impl ShlAssign<u64> for Fixed
impl ShlAssign<u64> for Fixed
Source§fn shl_assign(&mut self, rhs: u64)
fn shl_assign(&mut self, rhs: u64)
<<= operation. Read moreSource§impl ShlAssign<u8> for Fixed
impl ShlAssign<u8> for Fixed
Source§fn shl_assign(&mut self, rhs: u8)
fn shl_assign(&mut self, rhs: u8)
<<= operation. Read moreSource§impl ShlAssign<usize> for Fixed
impl ShlAssign<usize> for Fixed
Source§fn shl_assign(&mut self, rhs: usize)
fn shl_assign(&mut self, rhs: usize)
<<= operation. Read moreSource§impl ShrAssign<&i128> for Fixed
impl ShrAssign<&i128> for Fixed
Source§fn shr_assign(&mut self, rhs: &i128)
fn shr_assign(&mut self, rhs: &i128)
>>= operation. Read moreSource§impl ShrAssign<&i16> for Fixed
impl ShrAssign<&i16> for Fixed
Source§fn shr_assign(&mut self, rhs: &i16)
fn shr_assign(&mut self, rhs: &i16)
>>= operation. Read moreSource§impl ShrAssign<&i32> for Fixed
impl ShrAssign<&i32> for Fixed
Source§fn shr_assign(&mut self, rhs: &i32)
fn shr_assign(&mut self, rhs: &i32)
>>= operation. Read moreSource§impl ShrAssign<&i64> for Fixed
impl ShrAssign<&i64> for Fixed
Source§fn shr_assign(&mut self, rhs: &i64)
fn shr_assign(&mut self, rhs: &i64)
>>= operation. Read moreSource§impl ShrAssign<&i8> for Fixed
impl ShrAssign<&i8> for Fixed
Source§fn shr_assign(&mut self, rhs: &i8)
fn shr_assign(&mut self, rhs: &i8)
>>= operation. Read moreSource§impl ShrAssign<&isize> for Fixed
impl ShrAssign<&isize> for Fixed
Source§fn shr_assign(&mut self, rhs: &isize)
fn shr_assign(&mut self, rhs: &isize)
>>= operation. Read moreSource§impl ShrAssign<&u128> for Fixed
impl ShrAssign<&u128> for Fixed
Source§fn shr_assign(&mut self, rhs: &u128)
fn shr_assign(&mut self, rhs: &u128)
>>= operation. Read moreSource§impl ShrAssign<&u16> for Fixed
impl ShrAssign<&u16> for Fixed
Source§fn shr_assign(&mut self, rhs: &u16)
fn shr_assign(&mut self, rhs: &u16)
>>= operation. Read moreSource§impl ShrAssign<&u32> for Fixed
impl ShrAssign<&u32> for Fixed
Source§fn shr_assign(&mut self, rhs: &u32)
fn shr_assign(&mut self, rhs: &u32)
>>= operation. Read moreSource§impl ShrAssign<&u64> for Fixed
impl ShrAssign<&u64> for Fixed
Source§fn shr_assign(&mut self, rhs: &u64)
fn shr_assign(&mut self, rhs: &u64)
>>= operation. Read moreSource§impl ShrAssign<&u8> for Fixed
impl ShrAssign<&u8> for Fixed
Source§fn shr_assign(&mut self, rhs: &u8)
fn shr_assign(&mut self, rhs: &u8)
>>= operation. Read moreSource§impl ShrAssign<&usize> for Fixed
impl ShrAssign<&usize> for Fixed
Source§fn shr_assign(&mut self, rhs: &usize)
fn shr_assign(&mut self, rhs: &usize)
>>= operation. Read moreSource§impl ShrAssign<i128> for Fixed
impl ShrAssign<i128> for Fixed
Source§fn shr_assign(&mut self, rhs: i128)
fn shr_assign(&mut self, rhs: i128)
>>= operation. Read moreSource§impl ShrAssign<i16> for Fixed
impl ShrAssign<i16> for Fixed
Source§fn shr_assign(&mut self, rhs: i16)
fn shr_assign(&mut self, rhs: i16)
>>= operation. Read moreSource§impl ShrAssign<i32> for Fixed
impl ShrAssign<i32> for Fixed
Source§fn shr_assign(&mut self, rhs: i32)
fn shr_assign(&mut self, rhs: i32)
>>= operation. Read moreSource§impl ShrAssign<i64> for Fixed
impl ShrAssign<i64> for Fixed
Source§fn shr_assign(&mut self, rhs: i64)
fn shr_assign(&mut self, rhs: i64)
>>= operation. Read moreSource§impl ShrAssign<i8> for Fixed
impl ShrAssign<i8> for Fixed
Source§fn shr_assign(&mut self, rhs: i8)
fn shr_assign(&mut self, rhs: i8)
>>= operation. Read moreSource§impl ShrAssign<isize> for Fixed
impl ShrAssign<isize> for Fixed
Source§fn shr_assign(&mut self, rhs: isize)
fn shr_assign(&mut self, rhs: isize)
>>= operation. Read moreSource§impl ShrAssign<u128> for Fixed
impl ShrAssign<u128> for Fixed
Source§fn shr_assign(&mut self, rhs: u128)
fn shr_assign(&mut self, rhs: u128)
>>= operation. Read moreSource§impl ShrAssign<u16> for Fixed
impl ShrAssign<u16> for Fixed
Source§fn shr_assign(&mut self, rhs: u16)
fn shr_assign(&mut self, rhs: u16)
>>= operation. Read moreSource§impl ShrAssign<u32> for Fixed
impl ShrAssign<u32> for Fixed
Source§fn shr_assign(&mut self, rhs: u32)
fn shr_assign(&mut self, rhs: u32)
>>= operation. Read moreSource§impl ShrAssign<u64> for Fixed
impl ShrAssign<u64> for Fixed
Source§fn shr_assign(&mut self, rhs: u64)
fn shr_assign(&mut self, rhs: u64)
>>= operation. Read moreSource§impl ShrAssign<u8> for Fixed
impl ShrAssign<u8> for Fixed
Source§fn shr_assign(&mut self, rhs: u8)
fn shr_assign(&mut self, rhs: u8)
>>= operation. Read moreSource§impl ShrAssign<usize> for Fixed
impl ShrAssign<usize> for Fixed
Source§fn shr_assign(&mut self, rhs: usize)
fn shr_assign(&mut self, rhs: usize)
>>= operation. Read moreSource§impl SubAssign for Fixed
impl SubAssign for Fixed
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more