| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.GLib.Structs.MappedFile
Description
The MappedFile represents a file mapping created with
mappedFileNew. It has only private members and should
not be accessed directly.
Synopsis
- newtype MappedFile = MappedFile (ManagedPtr MappedFile)
- type family ResolveMappedFileMethod (t :: Symbol) o where ...
- data MappedFileFreeMethodInfo
- mappedFileFree :: (HasCallStack, MonadIO m) => MappedFile -> m ()
- data MappedFileGetBytesMethodInfo
- mappedFileGetBytes :: (HasCallStack, MonadIO m) => MappedFile -> m Bytes
- data MappedFileGetContentsMethodInfo
- mappedFileGetContents :: (HasCallStack, MonadIO m) => MappedFile -> m (Maybe Text)
- data MappedFileGetLengthMethodInfo
- mappedFileGetLength :: (HasCallStack, MonadIO m) => MappedFile -> m CSize
- mappedFileNew :: (HasCallStack, MonadIO m) => [Char] -> Bool -> m MappedFile
- mappedFileNewFromFd :: (HasCallStack, MonadIO m) => Int32 -> Bool -> m MappedFile
- data MappedFileRefMethodInfo
- mappedFileRef :: (HasCallStack, MonadIO m) => MappedFile -> m MappedFile
- data MappedFileUnrefMethodInfo
- mappedFileUnref :: (HasCallStack, MonadIO m) => MappedFile -> m ()
Exported types
newtype MappedFile Source #
Memory-managed wrapper type.
Constructors
| MappedFile (ManagedPtr MappedFile) |
Instances
Methods
Click to display all available methods, including inherited ones
type family ResolveMappedFileMethod (t :: Symbol) o where ... Source #
Equations
| ResolveMappedFileMethod "free" o = MappedFileFreeMethodInfo | |
| ResolveMappedFileMethod "ref" o = MappedFileRefMethodInfo | |
| ResolveMappedFileMethod "unref" o = MappedFileUnrefMethodInfo | |
| ResolveMappedFileMethod "getBytes" o = MappedFileGetBytesMethodInfo | |
| ResolveMappedFileMethod "getContents" o = MappedFileGetContentsMethodInfo | |
| ResolveMappedFileMethod "getLength" o = MappedFileGetLengthMethodInfo | |
| ResolveMappedFileMethod l o = MethodResolutionFailed l o :: Type |
free
data MappedFileFreeMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod MappedFileFreeMethodInfo MappedFile signature Source # | |
Defined in GI.GLib.Structs.MappedFile Methods overloadedMethod :: MappedFile -> signature # | |
| OverloadedMethodInfo MappedFileFreeMethodInfo MappedFile Source # | |
Defined in GI.GLib.Structs.MappedFile Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => MappedFile |
|
| -> m () |
Deprecated: (Since version 2.22)Use mappedFileUnref instead.
This call existed before MappedFile had refcounting and is currently
exactly the same as mappedFileUnref.
Since: 2.8
getBytes
data MappedFileGetBytesMethodInfo Source #
Instances
| (signature ~ m Bytes, MonadIO m) => OverloadedMethod MappedFileGetBytesMethodInfo MappedFile signature Source # | |
Defined in GI.GLib.Structs.MappedFile Methods overloadedMethod :: MappedFile -> signature # | |
| OverloadedMethodInfo MappedFileGetBytesMethodInfo MappedFile Source # | |
Defined in GI.GLib.Structs.MappedFile Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => MappedFile |
|
| -> m Bytes | Returns: A newly allocated |
getContents
data MappedFileGetContentsMethodInfo Source #
Instances
| (signature ~ m (Maybe Text), MonadIO m) => OverloadedMethod MappedFileGetContentsMethodInfo MappedFile signature Source # | |
Defined in GI.GLib.Structs.MappedFile Methods overloadedMethod :: MappedFile -> signature # | |
| OverloadedMethodInfo MappedFileGetContentsMethodInfo MappedFile Source # | |
Defined in GI.GLib.Structs.MappedFile Methods | |
mappedFileGetContents Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => MappedFile |
|
| -> m (Maybe Text) | Returns: the contents of |
Returns the contents of a MappedFile.
Note that the contents may not be zero-terminated,
even if the MappedFile is backed by a text file.
If the file is empty then Nothing is returned.
Since: 2.8
getLength
data MappedFileGetLengthMethodInfo Source #
Instances
| (signature ~ m CSize, MonadIO m) => OverloadedMethod MappedFileGetLengthMethodInfo MappedFile signature Source # | |
Defined in GI.GLib.Structs.MappedFile Methods overloadedMethod :: MappedFile -> signature # | |
| OverloadedMethodInfo MappedFileGetLengthMethodInfo MappedFile Source # | |
Defined in GI.GLib.Structs.MappedFile Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => MappedFile |
|
| -> m CSize | Returns: the length of the contents of |
Returns the length of the contents of a MappedFile.
Since: 2.8
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => [Char] |
|
| -> Bool |
|
| -> m MappedFile | Returns: a newly allocated |
Maps a file into memory. On UNIX, this is using the mmap() function.
If writable is True, the mapped buffer may be modified, otherwise
it is an error to modify the mapped buffer. Modifications to the buffer
are not visible to other processes mapping the same file, and are not
written back to the file.
Note that modifications of the underlying file might affect the contents
of the MappedFile. Therefore, mapping should only be used if the file
will not be modified, or if all modifications of the file are done
atomically (e.g. using fileSetContents).
If filename is the name of an empty, regular file, the function
will successfully return an empty MappedFile. In other cases of
size 0 (e.g. device files such as /dev/null), error will be set
to the FileError value FileErrorInval.
Since: 2.8
newFromFd
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Int32 |
|
| -> Bool |
|
| -> m MappedFile | Returns: a newly allocated |
Maps a file into memory. On UNIX, this is using the mmap() function.
If writable is True, the mapped buffer may be modified, otherwise
it is an error to modify the mapped buffer. Modifications to the buffer
are not visible to other processes mapping the same file, and are not
written back to the file.
Note that modifications of the underlying file might affect the contents
of the MappedFile. Therefore, mapping should only be used if the file
will not be modified, or if all modifications of the file are done
atomically (e.g. using fileSetContents).
Since: 2.32
ref
data MappedFileRefMethodInfo Source #
Instances
| (signature ~ m MappedFile, MonadIO m) => OverloadedMethod MappedFileRefMethodInfo MappedFile signature Source # | |
Defined in GI.GLib.Structs.MappedFile Methods overloadedMethod :: MappedFile -> signature # | |
| OverloadedMethodInfo MappedFileRefMethodInfo MappedFile Source # | |
Defined in GI.GLib.Structs.MappedFile Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => MappedFile |
|
| -> m MappedFile | Returns: the passed in |
Increments the reference count of file by one. It is safe to call
this function from any thread.
Since: 2.22
unref
data MappedFileUnrefMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod MappedFileUnrefMethodInfo MappedFile signature Source # | |
Defined in GI.GLib.Structs.MappedFile Methods overloadedMethod :: MappedFile -> signature # | |
| OverloadedMethodInfo MappedFileUnrefMethodInfo MappedFile Source # | |
Defined in GI.GLib.Structs.MappedFile Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => MappedFile |
|
| -> m () |
Decrements the reference count of file by one. If the reference count
drops to 0, unmaps the buffer of file and frees it.
It is safe to call this function from any thread.
Since 2.22