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?
348 unsafe fn handle_event(
349 &self,
350 queue: &Queue,
351 data: *mut u8,
352 slf: &UntypedBorrowedProxy,
353 opcode: u32,
354 args: *mut wl_argument,
355 ) {
356 // SAFETY: This function requires that slf has the interface INTERFACE
357 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletPadRingV2Ref>(slf) };
358 match opcode {
359 0 => {
360 // SAFETY: INTERFACE requires that there are 1 arguments
361 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
362 // SAFETY: - INTERFACE requires that args[0] contains a uint
363 let arg0 = unsafe { ZwpTabletPadRingV2Source(args[0].u) };
364 self.0.source(slf, arg0);
365 }
366 1 => {
367 // SAFETY: INTERFACE requires that there are 1 arguments
368 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
369 // SAFETY: - INTERFACE requires that args[0] contains a fixed
370 let arg0 = unsafe { Fixed::from_wire(args[0].f) };
371 self.0.angle(slf, arg0);
372 }
373 2 => {
374 self.0.stop(slf);
375 }
376 3 => {
377 // SAFETY: INTERFACE requires that there are 1 arguments
378 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
379 // SAFETY: - INTERFACE requires that args[0] contains a uint
380 let arg0 = unsafe { args[0].u };
381 self.0.frame(slf, arg0);
382 }
383 _ => {
384 invalid_opcode("zwp_tablet_pad_ring_v2", opcode);
385 }
386 }
387 }More examples
365 unsafe fn handle_event(
366 &self,
367 queue: &Queue,
368 data: *mut u8,
369 slf: &UntypedBorrowedProxy,
370 opcode: u32,
371 args: *mut wl_argument,
372 ) {
373 // SAFETY: This function requires that slf has the interface INTERFACE
374 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<ZwpTabletPadRingV2Ref>(slf) };
375 // SAFETY: This function requires that data is `&mut T` where `T`
376 // has the type id returned by `Self::mutable_type`, i.e.,
377 // `T = H::Data`.
378 let data: &mut H::Data = unsafe { &mut *data.cast() };
379 match opcode {
380 0 => {
381 // SAFETY: INTERFACE requires that there are 1 arguments
382 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
383 // SAFETY: - INTERFACE requires that args[0] contains a uint
384 let arg0 = unsafe { ZwpTabletPadRingV2Source(args[0].u) };
385 self.0.source(data, slf, arg0);
386 }
387 1 => {
388 // SAFETY: INTERFACE requires that there are 1 arguments
389 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
390 // SAFETY: - INTERFACE requires that args[0] contains a fixed
391 let arg0 = unsafe { Fixed::from_wire(args[0].f) };
392 self.0.angle(data, slf, arg0);
393 }
394 2 => {
395 self.0.stop(data, slf);
396 }
397 3 => {
398 // SAFETY: INTERFACE requires that there are 1 arguments
399 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
400 // SAFETY: - INTERFACE requires that args[0] contains a uint
401 let arg0 = unsafe { args[0].u };
402 self.0.frame(data, slf, arg0);
403 }
404 _ => {
405 invalid_opcode("zwp_tablet_pad_ring_v2", opcode);
406 }
407 }
408 }423 unsafe fn handle_event(
424 &self,
425 queue: &Queue,
426 data: *mut u8,
427 slf: &UntypedBorrowedProxy,
428 opcode: u32,
429 args: *mut wl_argument,
430 ) {
431 // SAFETY: This function requires that slf has the interface INTERFACE
432 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlTouchRef>(slf) };
433 match opcode {
434 0 => {
435 // SAFETY: INTERFACE requires that there are 6 arguments
436 let args = unsafe { &*args.cast::<[wl_argument; 6]>() };
437 // SAFETY: - INTERFACE requires that args[0] contains a uint
438 let arg0 = unsafe { args[0].u };
439 // SAFETY: - INTERFACE requires that args[1] contains a uint
440 let arg1 = unsafe { args[1].u };
441 // SAFETY: - INTERFACE requires that args[2] contains an object
442 let arg2 = unsafe {
443 if let Some(p) = NonNull::new(args[2].o.cast()) {
444 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
445 } else {
446 None
447 }
448 };
449 // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
450 let arg2 = arg2.as_ref().map(|arg2| unsafe {
451 proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg2)
452 });
453 // SAFETY: - INTERFACE requires that args[3] contains an int
454 let arg3 = unsafe { args[3].i };
455 // SAFETY: - INTERFACE requires that args[4] contains a fixed
456 let arg4 = unsafe { Fixed::from_wire(args[4].f) };
457 // SAFETY: - INTERFACE requires that args[5] contains a fixed
458 let arg5 = unsafe { Fixed::from_wire(args[5].f) };
459 self.0.down(slf, arg0, arg1, arg2, arg3, arg4, arg5);
460 }
461 1 => {
462 // SAFETY: INTERFACE requires that there are 3 arguments
463 let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
464 // SAFETY: - INTERFACE requires that args[0] contains a uint
465 let arg0 = unsafe { args[0].u };
466 // SAFETY: - INTERFACE requires that args[1] contains a uint
467 let arg1 = unsafe { args[1].u };
468 // SAFETY: - INTERFACE requires that args[2] contains an int
469 let arg2 = unsafe { args[2].i };
470 self.0.up(slf, arg0, arg1, arg2);
471 }
472 2 => {
473 // SAFETY: INTERFACE requires that there are 4 arguments
474 let args = unsafe { &*args.cast::<[wl_argument; 4]>() };
475 // SAFETY: - INTERFACE requires that args[0] contains a uint
476 let arg0 = unsafe { args[0].u };
477 // SAFETY: - INTERFACE requires that args[1] contains an int
478 let arg1 = unsafe { args[1].i };
479 // SAFETY: - INTERFACE requires that args[2] contains a fixed
480 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
481 // SAFETY: - INTERFACE requires that args[3] contains a fixed
482 let arg3 = unsafe { Fixed::from_wire(args[3].f) };
483 self.0.motion(slf, arg0, arg1, arg2, arg3);
484 }
485 3 => {
486 self.0.frame(slf);
487 }
488 4 => {
489 self.0.cancel(slf);
490 }
491 5 => {
492 // SAFETY: INTERFACE requires that there are 3 arguments
493 let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
494 // SAFETY: - INTERFACE requires that args[0] contains an int
495 let arg0 = unsafe { args[0].i };
496 // SAFETY: - INTERFACE requires that args[1] contains a fixed
497 let arg1 = unsafe { Fixed::from_wire(args[1].f) };
498 // SAFETY: - INTERFACE requires that args[2] contains a fixed
499 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
500 self.0.shape(slf, arg0, arg1, arg2);
501 }
502 6 => {
503 // SAFETY: INTERFACE requires that there are 2 arguments
504 let args = unsafe { &*args.cast::<[wl_argument; 2]>() };
505 // SAFETY: - INTERFACE requires that args[0] contains an int
506 let arg0 = unsafe { args[0].i };
507 // SAFETY: - INTERFACE requires that args[1] contains a fixed
508 let arg1 = unsafe { Fixed::from_wire(args[1].f) };
509 self.0.orientation(slf, arg0, arg1);
510 }
511 _ => {
512 invalid_opcode("wl_touch", opcode);
513 }
514 }
515 }451 unsafe fn handle_event(
452 &self,
453 queue: &Queue,
454 data: *mut u8,
455 slf: &UntypedBorrowedProxy,
456 opcode: u32,
457 args: *mut wl_argument,
458 ) {
459 // SAFETY: This function requires that slf has the interface INTERFACE
460 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlTouchRef>(slf) };
461 // SAFETY: This function requires that data is `&mut T` where `T`
462 // has the type id returned by `Self::mutable_type`, i.e.,
463 // `T = H::Data`.
464 let data: &mut H::Data = unsafe { &mut *data.cast() };
465 match opcode {
466 0 => {
467 // SAFETY: INTERFACE requires that there are 6 arguments
468 let args = unsafe { &*args.cast::<[wl_argument; 6]>() };
469 // SAFETY: - INTERFACE requires that args[0] contains a uint
470 let arg0 = unsafe { args[0].u };
471 // SAFETY: - INTERFACE requires that args[1] contains a uint
472 let arg1 = unsafe { args[1].u };
473 // SAFETY: - INTERFACE requires that args[2] contains an object
474 let arg2 = unsafe {
475 if let Some(p) = NonNull::new(args[2].o.cast()) {
476 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
477 } else {
478 None
479 }
480 };
481 // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
482 let arg2 = arg2.as_ref().map(|arg2| unsafe {
483 proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg2)
484 });
485 // SAFETY: - INTERFACE requires that args[3] contains an int
486 let arg3 = unsafe { args[3].i };
487 // SAFETY: - INTERFACE requires that args[4] contains a fixed
488 let arg4 = unsafe { Fixed::from_wire(args[4].f) };
489 // SAFETY: - INTERFACE requires that args[5] contains a fixed
490 let arg5 = unsafe { Fixed::from_wire(args[5].f) };
491 self.0.down(data, slf, arg0, arg1, arg2, arg3, arg4, arg5);
492 }
493 1 => {
494 // SAFETY: INTERFACE requires that there are 3 arguments
495 let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
496 // SAFETY: - INTERFACE requires that args[0] contains a uint
497 let arg0 = unsafe { args[0].u };
498 // SAFETY: - INTERFACE requires that args[1] contains a uint
499 let arg1 = unsafe { args[1].u };
500 // SAFETY: - INTERFACE requires that args[2] contains an int
501 let arg2 = unsafe { args[2].i };
502 self.0.up(data, slf, arg0, arg1, arg2);
503 }
504 2 => {
505 // SAFETY: INTERFACE requires that there are 4 arguments
506 let args = unsafe { &*args.cast::<[wl_argument; 4]>() };
507 // SAFETY: - INTERFACE requires that args[0] contains a uint
508 let arg0 = unsafe { args[0].u };
509 // SAFETY: - INTERFACE requires that args[1] contains an int
510 let arg1 = unsafe { args[1].i };
511 // SAFETY: - INTERFACE requires that args[2] contains a fixed
512 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
513 // SAFETY: - INTERFACE requires that args[3] contains a fixed
514 let arg3 = unsafe { Fixed::from_wire(args[3].f) };
515 self.0.motion(data, slf, arg0, arg1, arg2, arg3);
516 }
517 3 => {
518 self.0.frame(data, slf);
519 }
520 4 => {
521 self.0.cancel(data, slf);
522 }
523 5 => {
524 // SAFETY: INTERFACE requires that there are 3 arguments
525 let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
526 // SAFETY: - INTERFACE requires that args[0] contains an int
527 let arg0 = unsafe { args[0].i };
528 // SAFETY: - INTERFACE requires that args[1] contains a fixed
529 let arg1 = unsafe { Fixed::from_wire(args[1].f) };
530 // SAFETY: - INTERFACE requires that args[2] contains a fixed
531 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
532 self.0.shape(data, slf, arg0, arg1, arg2);
533 }
534 6 => {
535 // SAFETY: INTERFACE requires that there are 2 arguments
536 let args = unsafe { &*args.cast::<[wl_argument; 2]>() };
537 // SAFETY: - INTERFACE requires that args[0] contains an int
538 let arg0 = unsafe { args[0].i };
539 // SAFETY: - INTERFACE requires that args[1] contains a fixed
540 let arg1 = unsafe { Fixed::from_wire(args[1].f) };
541 self.0.orientation(data, slf, arg0, arg1);
542 }
543 _ => {
544 invalid_opcode("wl_touch", opcode);
545 }
546 }
547 }502 unsafe fn handle_event(
503 &self,
504 queue: &Queue,
505 data: *mut u8,
506 slf: &UntypedBorrowedProxy,
507 opcode: u32,
508 args: *mut wl_argument,
509 ) {
510 // SAFETY: This function requires that slf has the interface INTERFACE
511 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlDataDeviceRef>(slf) };
512 match opcode {
513 0 => {
514 // SAFETY: INTERFACE requires that there are 1 arguments
515 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
516 // SAFETY: - INTERFACE requires that args[0] contains an object
517 // - ownership is transferred to this function
518 // - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
519 let arg0 = unsafe {
520 UntypedOwnedProxy::from_plain_wl_proxy(
521 queue,
522 NonNull::new_unchecked(args[0].o.cast()),
523 WlDataOffer::WL_INTERFACE,
524 )
525 };
526 // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
527 let arg0 = unsafe { proxy::low_level::from_untyped_owned::<WlDataOffer>(arg0) };
528 self.0.data_offer(slf, arg0);
529 }
530 1 => {
531 // SAFETY: INTERFACE requires that there are 5 arguments
532 let args = unsafe { &*args.cast::<[wl_argument; 5]>() };
533 // SAFETY: - INTERFACE requires that args[0] contains a uint
534 let arg0 = unsafe { args[0].u };
535 // SAFETY: - INTERFACE requires that args[1] contains an object
536 let arg1 = unsafe {
537 if let Some(p) = NonNull::new(args[1].o.cast()) {
538 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
539 } else {
540 None
541 }
542 };
543 // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
544 let arg1 = arg1.as_ref().map(|arg1| unsafe {
545 proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg1)
546 });
547 // SAFETY: - INTERFACE requires that args[2] contains a fixed
548 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
549 // SAFETY: - INTERFACE requires that args[3] contains a fixed
550 let arg3 = unsafe { Fixed::from_wire(args[3].f) };
551 // SAFETY: - INTERFACE requires that args[4] contains an object
552 let arg4 = unsafe {
553 if let Some(p) = NonNull::new(args[4].o.cast()) {
554 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
555 } else {
556 None
557 }
558 };
559 // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
560 let arg4 = arg4.as_ref().map(|arg4| unsafe {
561 proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg4)
562 });
563 self.0.enter(slf, arg0, arg1, arg2, arg3, arg4);
564 }
565 2 => {
566 self.0.leave(slf);
567 }
568 3 => {
569 // SAFETY: INTERFACE requires that there are 3 arguments
570 let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
571 // SAFETY: - INTERFACE requires that args[0] contains a uint
572 let arg0 = unsafe { args[0].u };
573 // SAFETY: - INTERFACE requires that args[1] contains a fixed
574 let arg1 = unsafe { Fixed::from_wire(args[1].f) };
575 // SAFETY: - INTERFACE requires that args[2] contains a fixed
576 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
577 self.0.motion(slf, arg0, arg1, arg2);
578 }
579 4 => {
580 self.0.drop(slf);
581 }
582 5 => {
583 // SAFETY: INTERFACE requires that there are 1 arguments
584 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
585 // SAFETY: - INTERFACE requires that args[0] contains an object
586 let arg0 = unsafe {
587 if let Some(p) = NonNull::new(args[0].o.cast()) {
588 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
589 } else {
590 None
591 }
592 };
593 // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
594 let arg0 = arg0.as_ref().map(|arg0| unsafe {
595 proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg0)
596 });
597 self.0.selection(slf, arg0);
598 }
599 _ => {
600 invalid_opcode("wl_data_device", opcode);
601 }
602 }
603 }527 unsafe fn handle_event(
528 &self,
529 queue: &Queue,
530 data: *mut u8,
531 slf: &UntypedBorrowedProxy,
532 opcode: u32,
533 args: *mut wl_argument,
534 ) {
535 // SAFETY: This function requires that slf has the interface INTERFACE
536 let slf = unsafe { proxy::low_level::from_untyped_borrowed::<WlDataDeviceRef>(slf) };
537 // SAFETY: This function requires that data is `&mut T` where `T`
538 // has the type id returned by `Self::mutable_type`, i.e.,
539 // `T = H::Data`.
540 let data: &mut H::Data = unsafe { &mut *data.cast() };
541 match opcode {
542 0 => {
543 // SAFETY: INTERFACE requires that there are 1 arguments
544 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
545 // SAFETY: - INTERFACE requires that args[0] contains an object
546 // - ownership is transferred to this function
547 // - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
548 let arg0 = unsafe {
549 UntypedOwnedProxy::from_plain_wl_proxy(
550 queue,
551 NonNull::new_unchecked(args[0].o.cast()),
552 WlDataOffer::WL_INTERFACE,
553 )
554 };
555 // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
556 let arg0 = unsafe { proxy::low_level::from_untyped_owned::<WlDataOffer>(arg0) };
557 self.0.data_offer(data, slf, arg0);
558 }
559 1 => {
560 // SAFETY: INTERFACE requires that there are 5 arguments
561 let args = unsafe { &*args.cast::<[wl_argument; 5]>() };
562 // SAFETY: - INTERFACE requires that args[0] contains a uint
563 let arg0 = unsafe { args[0].u };
564 // SAFETY: - INTERFACE requires that args[1] contains an object
565 let arg1 = unsafe {
566 if let Some(p) = NonNull::new(args[1].o.cast()) {
567 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
568 } else {
569 None
570 }
571 };
572 // SAFETY: - INTERFACE requires that the object has the interface WlSurface::WL_INTERFACE
573 let arg1 = arg1.as_ref().map(|arg1| unsafe {
574 proxy::low_level::from_untyped_borrowed::<WlSurfaceRef>(arg1)
575 });
576 // SAFETY: - INTERFACE requires that args[2] contains a fixed
577 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
578 // SAFETY: - INTERFACE requires that args[3] contains a fixed
579 let arg3 = unsafe { Fixed::from_wire(args[3].f) };
580 // SAFETY: - INTERFACE requires that args[4] contains an object
581 let arg4 = unsafe {
582 if let Some(p) = NonNull::new(args[4].o.cast()) {
583 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
584 } else {
585 None
586 }
587 };
588 // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
589 let arg4 = arg4.as_ref().map(|arg4| unsafe {
590 proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg4)
591 });
592 self.0.enter(data, slf, arg0, arg1, arg2, arg3, arg4);
593 }
594 2 => {
595 self.0.leave(data, slf);
596 }
597 3 => {
598 // SAFETY: INTERFACE requires that there are 3 arguments
599 let args = unsafe { &*args.cast::<[wl_argument; 3]>() };
600 // SAFETY: - INTERFACE requires that args[0] contains a uint
601 let arg0 = unsafe { args[0].u };
602 // SAFETY: - INTERFACE requires that args[1] contains a fixed
603 let arg1 = unsafe { Fixed::from_wire(args[1].f) };
604 // SAFETY: - INTERFACE requires that args[2] contains a fixed
605 let arg2 = unsafe { Fixed::from_wire(args[2].f) };
606 self.0.motion(data, slf, arg0, arg1, arg2);
607 }
608 4 => {
609 self.0.drop(data, slf);
610 }
611 5 => {
612 // SAFETY: INTERFACE requires that there are 1 arguments
613 let args = unsafe { &*args.cast::<[wl_argument; 1]>() };
614 // SAFETY: - INTERFACE requires that args[0] contains an object
615 let arg0 = unsafe {
616 if let Some(p) = NonNull::new(args[0].o.cast()) {
617 Some(UntypedBorrowedProxy::new_immutable(queue.libwayland(), p))
618 } else {
619 None
620 }
621 };
622 // SAFETY: - INTERFACE requires that the object has the interface WlDataOffer::WL_INTERFACE
623 let arg0 = arg0.as_ref().map(|arg0| unsafe {
624 proxy::low_level::from_untyped_borrowed::<WlDataOfferRef>(arg0)
625 });
626 self.0.selection(data, slf, arg0);
627 }
628 _ => {
629 invalid_opcode("wl_data_device", opcode);
630 }
631 }
632 }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?
240 pub fn set_source(&self, x: Fixed, y: Fixed, width: Fixed, height: Fixed) {
241 let (arg0, arg1, arg2, arg3) = (x, y, width, height);
242 let mut args = [
243 wl_argument { f: arg0.to_wire() },
244 wl_argument { f: arg1.to_wire() },
245 wl_argument { f: arg2.to_wire() },
246 wl_argument { f: arg3.to_wire() },
247 ];
248 // SAFETY: - self.proxy has the interface INTERFACE
249 // - 1 < INTERFACE.method_count = 3
250 // - the request signature is `ffff`
251 unsafe {
252 self.proxy.send_request(1, &mut args);
253 }
254 }More examples
240 pub fn set_source(&self, x: Fixed, y: Fixed, width: Fixed, height: Fixed) {
241 let (arg0, arg1, arg2, arg3) = (x, y, width, height);
242 let mut args = [
243 wl_argument { f: arg0.to_wire() },
244 wl_argument { f: arg1.to_wire() },
245 wl_argument { f: arg2.to_wire() },
246 wl_argument { f: arg3.to_wire() },
247 ];
248 // SAFETY: - self.proxy has the interface INTERFACE
249 // - 1 < INTERFACE.method_count = 3
250 // - the request signature is `ffff`
251 unsafe {
252 self.proxy.send_request(1, &mut args);
253 }
254 }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 moreimpl Copy for Fixed
Source§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 moreimpl Eq for Fixed
Source§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
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
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<&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<&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<&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<&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<&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<&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<&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<&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<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<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<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<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<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<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<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<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<&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<&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<&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<&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<&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<&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<&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<&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<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<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<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<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<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<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<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<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 more