本文簡要介紹rust語言中 core::time::Duration.mul_f32
的用法。
用法
pub fn mul_f32(self, rhs: f32) -> Duration
將 Duration
乘以 f32
。
Panics
如果結果不是有限的、負的或溢出 Duration
,此方法將Panics。
例子
use std::time::Duration;
let dur = Duration::new(2, 700_000_000);
// note that due to rounding errors result is slightly different
// from 8.478 and 847800.0
assert_eq!(dur.mul_f32(3.14), Duration::new(8, 478_000_640));
assert_eq!(dur.mul_f32(3.14e5), Duration::new(847799, 969_120_256));
相關用法
- Rust Duration.mul_f64用法及代碼示例
- Rust Duration.as_micros用法及代碼示例
- Rust Duration.subsec_nanos用法及代碼示例
- Rust Duration.checked_add用法及代碼示例
- Rust Duration.new用法及代碼示例
- Rust Duration.subsec_micros用法及代碼示例
- Rust Duration.from_millis用法及代碼示例
- Rust Duration.try_from_secs_f32用法及代碼示例
- Rust Duration.is_zero用法及代碼示例
- Rust Duration.from_secs用法及代碼示例
- Rust Duration.from_nanos用法及代碼示例
- Rust Duration.as_secs_f64用法及代碼示例
- Rust Duration.from_secs_f32用法及代碼示例
- Rust Duration.from_micros用法及代碼示例
- Rust Duration.saturating_add用法及代碼示例
- Rust Duration.try_from_secs_f64用法及代碼示例
- Rust Duration.as_secs_f32用法及代碼示例
- Rust Duration.from_secs_f64用法及代碼示例
- Rust Duration.as_millis用法及代碼示例
- Rust Duration.as_nanos用法及代碼示例
- Rust Duration.checked_sub用法及代碼示例
- Rust Duration.subsec_millis用法及代碼示例
- Rust Duration.div_f32用法及代碼示例
- Rust Duration.saturating_sub用法及代碼示例
- Rust Duration.checked_div用法及代碼示例
注:本文由純淨天空篩選整理自rust-lang.org大神的英文原創作品 core::time::Duration.mul_f32。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。