Skip to content

Commit

Permalink
feat: add more overloaded operators
Browse files Browse the repository at this point in the history
  • Loading branch information
ezoushen committed Sep 3, 2023
1 parent 0687766 commit 1f3dad3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/DataModel/Entity/ReadOnly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,18 @@ extension ReadOnly {
}
}

@inlinable public func => <T: Crush.Entity, S: Crush.Entity>(lhs: S.ReadOnly, rhs: T.Type) -> T.ReadOnly {
lhs.unsafeCast(to: rhs)
}

@inlinable public func => <T: Crush.Entity, S: Crush.Entity>(lhs: S.ReadOnly?, rhs: T.Type) -> T.ReadOnly? {
lhs?.unsafeCast(to: rhs)
}

@inlinable public func ~> <T: Crush.Entity, S: Crush.Entity>(lhs: S.ReadOnly?, rhs: T.Type) -> T.ReadOnly? {
lhs?.cast(to: rhs)
}

public protocol ReadaleObject { }

extension Entity: ReadaleObject { }
Expand Down

0 comments on commit 1f3dad3

Please sign in to comment.