Skip to content

Commit

Permalink
Update StaticBody
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Feb 25, 2024
1 parent 089e31a commit 4b0bb2a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"location" : "https://github.com/OpenSwiftUIProject/OpenGraph",
"state" : {
"branch" : "main",
"revision" : "b4486fa4a1efffacae01a9df54c1545b1b6e0462"
"revision" : "6133e9f737077b5c75ff33dee1c2c969cb5d91b4"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,16 @@ private protocol RuleThreadFlags {
}

private struct AsyncThreadFlags: RuleThreadFlags {
static var value: OGAttributeTypeFlags { .init(rawValue: 1 << 5) }
static var value: OGAttributeTypeFlags { .asyncThread }
}

private struct MainThreadFlags: RuleThreadFlags {
static var value: OGAttributeTypeFlags { ._8 }
static var value: OGAttributeTypeFlags { .mainThread }
}


// MARK: - StaticBody

private struct StaticBody<Accessor: BodyAccessor, ThreadFlags: RuleThreadFlags>: CustomStringConvertible, BodyAccessorRule/*, StatefulRule*/ {
private struct StaticBody<Accessor: BodyAccessor, ThreadFlags: RuleThreadFlags> {
let accessor: Accessor
@Attribute
var container: Accessor.Container
Expand All @@ -125,19 +124,23 @@ private struct StaticBody<Accessor: BodyAccessor, ThreadFlags: RuleThreadFlags>:
self.accessor = accessor
self._container = container
}

}

extension StaticBody: StatefulRule {
typealias Value = Accessor.Body

func updateValue() {
accessor.updateBody(of: container, changed: true)
}

var description: String {
"\(Accessor.Body.self)"
}

}

extension StaticBody: _AttributeBody {
static var flags: OGAttributeTypeFlags {
ThreadFlags.value
}

}

extension StaticBody: BodyAccessorRule {
static var container: Any.Type {
Accessor.Container.self
}
Expand All @@ -160,3 +163,7 @@ private struct StaticBody<Accessor: BodyAccessor, ThreadFlags: RuleThreadFlags>:
return [("@self", attribute.info.body.assumingMemoryBound(to: Self.self).pointee._container.identifier)]
}
}

extension StaticBody: CustomStringConvertible {
var description: String { "\(Accessor.Body.self)" }
}

0 comments on commit 4b0bb2a

Please sign in to comment.