the.bay.news

Ownership pattern matching questions

Swift Forums
Ownership pattern matching questions
I'm exploring ownership accessors by re-implementing Rust types in Swift. public enum Cow<B : ToOwned & ~Copyable> : Borrow, Clone, ~Escapable { /// Borrowed data. case borrowed(Ref<B>) /// Owned data. case owned(B.Owned) public var value: B { borrow { switch self { case let .borrowed(b): b.value case let .owned(b): b.value } } mutate { switch self { case let .borrowed(b): self = .owned(b.value.toOwned()) switch self { case .owned(var o): return &o.valu...

I'm exploring ownership accessors by re-implementing Rust types in Swift. public enum Cow<B : ToOwned & ~Copyable> : Borrow, Clone, ~Escapable { /// Borrowed data. case…

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.