Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains functions for working with
ClangString
s, which represent strings that are part of the
libclang AST or managed by its API.
This module is intended to be imported qualified.
- unpack :: ClangBase m => ClangString s' -> ClangT s m String
- unpackText :: ClangBase m => ClangString s' -> ClangT s m Text
- unpackByteString :: ClangBase m => ClangString s' -> ClangT s m ByteString
- unsafeUnpackByteString :: ClangBase m => ClangString s' -> ClangT s m ByteString
Conversions
unpack :: ClangBase m => ClangString s' -> ClangT s m String Source
Converts an ClangString
to a String
.
unpackText :: ClangBase m => ClangString s' -> ClangT s m Text Source
Converts an ClangString
to a Text
.
unpackByteString :: ClangBase m => ClangString s' -> ClangT s m ByteString Source
Converts an ClangString
to a ByteString
. This is faster
than unpack
and unpackText
since it requires no encoding.
Unsafe conversions
unsafeUnpackByteString :: ClangBase m => ClangString s' -> ClangT s m ByteString Source
Creates a ByteString
that shares the underlying memory of the
ClangString
. This is very fast since no copying has to be
done. However, it's also unsafe because the ByteString
may outlive
the scope of the ClangString
, leading to corruption of
its contents or crashes. It's the caller's responsibility to
prevent this.