All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.app.bsky.richtext.facetByteSlice.kt Maven / Gradle / Ivy

The newest version!
@file:Suppress("DEPRECATION")

package app.bsky.richtext

import kotlin.Long
import kotlin.Suppress
import kotlinx.serialization.Serializable

/**
 * Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is
 * exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages,
 * like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages,
 * convert to byte arrays before working with facets.
 */
@Serializable
public data class FacetByteSlice(
  public val byteStart: Long,
  public val byteEnd: Long,
) {
  init {
    require(byteStart >= 0) {
      "byteStart must be >= 0, but was $byteStart"
    }
    require(byteEnd >= 0) {
      "byteEnd must be >= 0, but was $byteEnd"
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy