From 1f3dad3719564fd9261d0deba561d0d7b2eb1bc9 Mon Sep 17 00:00:00 2001 From: ezoushen Date: Sun, 3 Sep 2023 22:10:37 +0800 Subject: [PATCH] feat: add more overloaded operators --- Sources/DataModel/Entity/ReadOnly.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/DataModel/Entity/ReadOnly.swift b/Sources/DataModel/Entity/ReadOnly.swift index c658884d..120c808e 100644 --- a/Sources/DataModel/Entity/ReadOnly.swift +++ b/Sources/DataModel/Entity/ReadOnly.swift @@ -213,6 +213,18 @@ extension ReadOnly { } } +@inlinable public func => (lhs: S.ReadOnly, rhs: T.Type) -> T.ReadOnly { + lhs.unsafeCast(to: rhs) +} + +@inlinable public func => (lhs: S.ReadOnly?, rhs: T.Type) -> T.ReadOnly? { + lhs?.unsafeCast(to: rhs) +} + +@inlinable public func ~> (lhs: S.ReadOnly?, rhs: T.Type) -> T.ReadOnly? { + lhs?.cast(to: rhs) +} + public protocol ReadaleObject { } extension Entity: ReadaleObject { }