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

scala.scalanative.posix.sys.uio.scala Maven / Gradle / Ivy

There is a newer version: 0.5.5
Show newest version
package scala.scalanative
package posix
package sys

import scalanative.unsafe._

@extern
@define("__SCALANATIVE_POSIX_SYS_UIO")
object uio {
  type iovec = CStruct2[
    Ptr[Byte], // iov_base
    CSize // iov_len
  ]

  @blocking def readv(d: CInt, buf: Ptr[iovec], iovcnt: CInt): CSSize = extern

  @blocking def writev(fildes: CInt, iov: Ptr[iovec], iovcnt: CInt): CSSize =
    extern
}

object uioOps {
  import uio.iovec

  implicit class iovecOps(val ptr: Ptr[iovec]) extends AnyVal {
    def iov_base: Ptr[Byte] = ptr._1
    def iov_len: CSize = ptr._2
    def iov_base_=(v: Ptr[Byte]): Unit = ptr._1 = v
    def iov_len_=(v: CSize): Unit = ptr._2 = v
  }

  implicit class iovecValOps(val vec: iovec) extends AnyVal {
    def iov_base: Ptr[Byte] = vec._1
    def iov_len: CSize = vec._2
    def iov_base_=(v: Ptr[Byte]): Unit = vec._1 = v
    def iov_len_=(v: CSize): Unit = vec._2 = v
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy