# \[Pitch #3\] Structured Concurrency

**URL:** <https://forums.swift.org/t/pitch-3-structured-concurrency/44496>\
**Category:** Pitches\
**Created:** [February 5, 2021, 11:08pm UTC](https://forums.swift.org/t/pitch-3-structured-concurrency/44496 "2021-02-05T23:08:19Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![benrimmington](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/benrimmington/32/695_2.png) [@benrimmington](https://forums.swift.org/u/benrimmington)\
**Post date:** [February 10, 2021, 8:11pm UTC](https://forums.swift.org/t/pitch-3-structured-concurrency/44496/15 "2021-02-10T20:11:25Z")

</div>

[`URLSessionTask.priority`](https://developer.apple.com/documentation/foundation/urlsessiontask/1410569-priority) is a floating-point value between 0.0 (lowest) and 1.0 (highest).

[`Task.Priority`](https://github.com/DougGregor/swift-evolution/blob/structured-concurrency/proposals/nnnn-structured-concurrency.md#task-priorities-1) could use similar names and raw values. For example:

```swift
extension Task {

  public struct Priority: Hashable, RawRepresentable {

    public static let lowest: Self = 0.0 // background
    public static let low: Self = 0.25 // utility
    public static let medium: Self = 0.5 // default
    public static let high: Self = 0.75 // userInitiated
    public static let highest: Self = 1.0 // userInteractive

    public typealias RawValue = Float32

    public let rawValue: RawValue

    public init(rawValue: RawValue) {
      self.rawValue = rawValue // FIXME: rawValue.clamped(to: 0...1)
    }
  }
}

extension Task.Priority: ExpressibleByFloatLiteral {

  public typealias FloatLiteralType = RawValue

  public init(floatLiteral rawValue: RawValue) {
    self.init(rawValue: rawValue)
  }
}

extension Task.Priority: Comparable {

  public static func < (_ lhs: Self, _ rhs: Self) -> Bool {
    lhs.rawValue < rhs.rawValue
  }
}

```

---

_[View the full topic](https://forums.swift.org/t/pitch-3-structured-concurrency/44496)._
