| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
FlatBuffers.Internal.FileIdentifier
Synopsis
- class HasFileIdentifier a where
- data FileIdentifier
- fileIdentifier :: Text -> Maybe FileIdentifier
- fileIdentifier' :: ByteString -> Maybe FileIdentifier
- unsafeFileIdentifier :: Text -> FileIdentifier
- unsafeFileIdentifier' :: ByteString -> FileIdentifier
Documentation
class HasFileIdentifier a where Source #
Associates a type with a file identifier.
To create an association, declare a root_type and file_identifier in your schema.
table Player {}
root_type Player;
file_identifier "PLYR";Methods
data FileIdentifier Source #
An identifier that's used to "mark" a buffer.
To add this marker to a buffer, use encodeWithFileIdentifier.
To check whether a buffer contains the marker before decoding it, use checkFileIdentifier.
For more information on file identifiers, see :
- The library's docs
- Section "File identification and extension" of the official docs
Instances
| Eq FileIdentifier Source # | |
Defined in FlatBuffers.Internal.FileIdentifier Methods (==) :: FileIdentifier -> FileIdentifier -> Bool # (/=) :: FileIdentifier -> FileIdentifier -> Bool # | |
| Show FileIdentifier Source # | |
Defined in FlatBuffers.Internal.FileIdentifier Methods showsPrec :: Int -> FileIdentifier -> ShowS # show :: FileIdentifier -> String # showList :: [FileIdentifier] -> ShowS # | |
fileIdentifier :: Text -> Maybe FileIdentifier Source #
Encodes the input text as UTF-8 and returns a Just FileIdentifier if it has exactly 4 bytes,
otherwise Nothing.
fileIdentifier' :: ByteString -> Maybe FileIdentifier Source #
Returns a Just FileIdentifier if the input ByteString has exactly 4 bytes,
otherwise Nothing.
unsafeFileIdentifier :: Text -> FileIdentifier Source #
Constructs a new FileIdentifier without checking its length.
unsafeFileIdentifier' :: ByteString -> FileIdentifier Source #
Constructs a new FileIdentifier without checking its length.