blob: 0430d65c27eb2a6cdbf6481d6954dce8fa549556 [file] [log] [blame]
Roman Elizarovf16fd272017-02-07 11:26:00 +03001/*
Roman Elizarov1f74a2d2018-06-29 19:19:45 +03002 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
Roman Elizarovf16fd272017-02-07 11:26:00 +03003 */
4
Roman Elizarov3754f952017-01-18 20:47:54 +03005package kotlinx.coroutines.experimental
6
Roman Elizarovea4a51b2017-01-31 12:01:25 +03007import kotlin.coroutines.experimental.AbstractCoroutineContextElement
8import kotlin.coroutines.experimental.CoroutineContext
Roman Elizarov3754f952017-01-18 20:47:54 +03009
10/**
11 * User-specified name of coroutine. This name is used in debugging mode.
12 * See [newCoroutineContext] for the description of coroutine debugging facilities.
13 */
Roman Elizarovf138bbc2017-02-09 19:13:08 +030014public data class CoroutineName(
15 /**
16 * User-defined coroutine name.
17 */
18 val name: String
19) : AbstractCoroutineContextElement(CoroutineName) {
20 /**
21 * Key for [CoroutineName] instance in the coroutine context.
22 */
Roman Elizarov3754f952017-01-18 20:47:54 +030023 public companion object Key : CoroutineContext.Key<CoroutineName>
Roman Elizarovf138bbc2017-02-09 19:13:08 +030024
25 /**
26 * Returns a string representation of the object.
27 */
Roman Elizarov3754f952017-01-18 20:47:54 +030028 override fun toString(): String = "CoroutineName($name)"
29}