mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-27 04:01:11 +08:00
docs: 改写 Temporal 共享与差量层注释
- common.rs 模块头删「最小实现子集」,补 Duration 槽位并逐类型列出 prop 布局; reject_partial_object_with_calendar_or_time_zone 文档改中文语义句并移操作名入括注 - instant.rs round_instant_ns 文档改「语义在前 + 操作名括注」,补 increment/溢出边界 - duration.rs duration_compare 步骤 4 与相等短路注释删除测试名,写明日历单位必须依赖相对点 - difference.rs 改写差值设置解析两处文档(去箭头电报体与裸操作名)、 nudge/bubble 两处函数文档、进位边界范围校验说明,统一 Nudge 族为中文语义加括注
This commit is contained in:
@@ -506,7 +506,14 @@ fn instant_round_unit(value: &str) -> Option<(i128, i128)> {
|
||||
}
|
||||
}
|
||||
|
||||
/// 按 Temporal 的 `RoundNumberToIncrementAsIfPositive` 语义舍入纳秒。
|
||||
/// 把纳秒值舍入到 increment 的整数倍。
|
||||
///
|
||||
/// 余数恒按非负处理,负值也按正向增长选取取整边界(RoundNumberToIncrementAsIfPositive
|
||||
/// 语义);半值模式按余数与半增量的大小关系决定方向,halfEven 例外地看商的奇偶。
|
||||
///
|
||||
/// # 边界与前提
|
||||
/// - increment 必须为正,否则除零。
|
||||
/// - 舍入结果超出 i128 表示范围时返回 None。
|
||||
pub(crate) fn round_instant_ns(value: i128, increment: i128, mode: InstantRoundingMode) -> Option<i128> {
|
||||
let quotient = value.div_euclid(increment);
|
||||
let remainder = value.rem_euclid(increment);
|
||||
|
||||
Reference in New Issue
Block a user