Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T03:36:04.012Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

unclipped.rs

52 lines · 1.3 KB · rust
1use crate::ChunkSummary;
2use std::ops::{Add, AddAssign, Sub, SubAssign};
3
4#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
5pub struct Unclipped<T>(pub T);
6
7impl<T> From<T> for Unclipped<T> {
8    fn from(value: T) -> Self {
9        Unclipped(value)
10    }
11}
12
13impl<'a, T: sum_tree::Dimension<'a, ChunkSummary>> sum_tree::Dimension<'a, ChunkSummary>
14    for Unclipped<T>
15{
16    fn zero(_: ()) -> Self {
17        Self(T::zero(()))
18    }
19
20    fn add_summary(&mut self, summary: &'a ChunkSummary, _: ()) {
21        self.0.add_summary(summary, ());
22    }
23}
24
25impl<T: Add<T, Output = T>> Add<Unclipped<T>> for Unclipped<T> {
26    type Output = Unclipped<T>;
27
28    fn add(self, rhs: Unclipped<T>) -> Self::Output {
29        Unclipped(self.0 + rhs.0)
30    }
31}
32
33impl<T: Sub<T, Output = T>> Sub<Unclipped<T>> for Unclipped<T> {
34    type Output = Unclipped<T>;
35
36    fn sub(self, rhs: Unclipped<T>) -> Self::Output {
37        Unclipped(self.0 - rhs.0)
38    }
39}
40
41impl<T: AddAssign<T>> AddAssign<Unclipped<T>> for Unclipped<T> {
42    fn add_assign(&mut self, rhs: Unclipped<T>) {
43        self.0 += rhs.0;
44    }
45}
46
47impl<T: SubAssign<T>> SubAssign<Unclipped<T>> for Unclipped<T> {
48    fn sub_assign(&mut self, rhs: Unclipped<T>) {
49        self.0 -= rhs.0;
50    }
51}
52
Served at tenant.openagents/omega Member data and write actions are omitted.