1 /* 2 * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 package kotlinx.coroutines 6 7 import kotlin.coroutines.AbstractCoroutineContextElement 8 import kotlin.coroutines.CoroutineContext 9 10 /** 11 * User-specified name of coroutine. This name is used in debugging mode. 12 * See [newCoroutineContext][CoroutineScope.newCoroutineContext] for the description of coroutine debugging facilities. 13 */ 14 public 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 */ 23 public companion object Key : CoroutineContext.Key<CoroutineName> 24 25 /** 26 * Returns a string representation of the object. 27 */ toStringnull28 override fun toString(): String = "CoroutineName($name)" 29 } 30