Gitbutler >:(

I don't understand this piece of software at all
This commit is contained in:
2024-12-31 00:03:39 +01:00
parent 3a3ae98aff
commit e780969c6c
42 changed files with 1119 additions and 498 deletions

View File

@@ -1,26 +0,0 @@
pub trait ApiEquiv {
type Api;
}
pub trait ToApi: Sized + ApiEquiv {
type Ctx;
fn to_api(&self, ctx: &mut Self::Ctx) -> Self::Api;
fn into_api(self, ctx: &mut Self::Ctx) -> Self::Api { self.to_api(ctx) }
}
pub trait FromApi: ApiEquiv {
type Ctx;
fn from_api(api: &Self::Api, ctx: &mut Self::Ctx) -> Self;
}
/// This is the weakest kind of conversion possible;
/// By holding a reference to the source type, you can provide a reference to the target type.
/// Unlike Into, the target type may hold references into the source,
/// but unlike AsRef, it doesn't have to be fully contained in the source.
/// The resulting object is stackbound so its utility is very limited.
pub trait ProjectionMut<T> {
fn with_built<R>(&mut self, cb: impl FnOnce(&mut T) -> R) -> R;
}
impl<T> ProjectionMut<T> for T {
fn with_built<R>(&mut self, cb: impl FnOnce(&mut T) -> R) -> R { cb(self) }
}

View File

@@ -2,10 +2,8 @@ mod coding;
mod helpers;
mod hierarchy;
mod relations;
mod api_conv;
pub use coding::*;
pub use helpers::*;
pub use hierarchy::*;
pub use relations::*;
pub use api_conv::*;