1 /*
2  * Copyright 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package androidx.compose.ui.text
18 
19 import kotlin.jvm.JvmInline
20 
21 /**
22  * An [AnnotatedString.Annotation] class which holds a String [value].
23  *
24  * You can use it to provide a custom annotation to the [AnnotatedString].
25  *
26  * If you use the [AnnotatedString.Builder] methods like [withAnnotation] and provide a string
27  * annotation, it will be automatically wrapped into this holder class.
28  *
29  * @see withAnnotation
30  * @see getStringAnnotations
31  */
32 @JvmInline value class StringAnnotation(val value: String) : AnnotatedString.Annotation
33 
unboxnull34 internal fun AnnotatedString.Range<out AnnotatedString.Annotation>.unbox():
35     AnnotatedString.Range<String> =
36     AnnotatedString.Range((item as StringAnnotation).value, start, end, tag)
37