Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T04:33:11.197Z 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

offset_utf16.rs

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