Core Uncomplicate functions useful across all projects.
Projects that use native libraries and FFI typically need to dispose resources properly.
To make this uniform, the typical resource managers need to implement the Releaseable
protocol. Clients can then use the following functions to manage resources:
[[release]] releaseable?
, with-release
, let-release
.
It is often the case that you need an access to a mutable resource, but you want to
protect the object's resource from destruction. For such cases (and other cases
when this might be useful) there is a Viewable
protocol. The [[view]] function
should return a 'portal' to the object whose [[release]] implementation does nothing
to the underlying resource.
For cases where you'd like to have the ability to inspect an object for various
internal detail, but don't want to clutter its interface with many additional
functions not related to the domain itself, implement the Info
protocol.
The [[info]] method returns a hash-map of all available information, or, if provided
with a key, only the specific property related to that key.
Objects that manage data of certain size can implement protocols Entries
and Bytes
.
Use the following functions to query for the data properties: size
, sizeof
, and bytesize
.
The following functions might be useful from time to time when dealing with primitive types.
types
, double-fn
, long-fn
,
wrap-byte
wrap-short
wrap-int
wrap-long
wrap-float
wrap-double
,
Mappable
, [[map]], [[unmap]].
Please refer to the tests folder, and to the source of other Uncomplicate projects to see how the functions from this namespace can be useful in various ways.
Core Uncomplicate functions useful across all projects. Projects that use native libraries and FFI typically need to dispose resources properly. To make this uniform, the typical resource managers need to implement the [[Releaseable]] protocol. Clients can then use the following functions to manage resources: [[release]] [[releaseable?]], [[with-release]], [[let-release]]. It is often the case that you need an access to a mutable resource, but you want to protect the object's resource from destruction. For such cases (and other cases when this might be useful) there is a [[Viewable]] protocol. The [[view]] function should return a 'portal' to the object whose [[release]] implementation does nothing to the underlying resource. For cases where you'd like to have the ability to inspect an object for various internal detail, but don't want to clutter its interface with many additional functions not related to the domain itself, implement the [[Info]] protocol. The [[info]] method returns a hash-map of all available information, or, if provided with a key, only the specific property related to that key. Objects that manage data of certain size can implement protocols [[Entries]] and [[Bytes]]. Use the following functions to query for the data properties: [[size]], [[sizeof]], and [[bytesize]]. The following functions might be useful from time to time when dealing with primitive types. [[types]], [[double-fn]], [[long-fn]], [[wrap-byte]] [[wrap-short]] [[wrap-int]] [[wrap-long]][[wrap-float]][[wrap-double]], [[Mappable]], [[map]], [[unmap]]. Please refer to the tests folder, and to the source of other Uncomplicate projects to see how the functions from this namespace can be useful in various ways.
Assorted utility functions used across Uncomplicate projects.
For converting keyword options to integers, use mask
, unmask
, and unmask1
.
For converting C-style error as returned numbers to exceptions, use with-check
and
dragan-says-ex
.
A few assorted functions: enc-keyword
, cond-into
.
When working with ByteBuffers
, enlist the following functions for help:
direct-buffer
, slice-buffer
, capacity
,
put-float!
get-float
put-double!
get-double
put-long!
get-long
put-int!
get-int
put-short!
get-short
put-byte!
get-byte
When mapping files to direct buffers, these functions can help.
mapped-buffer
, reverse-short-bytes!
, reverse-long-bytes!
The following functions are useful when working with Java file channels.
[[dev-open-option]], channel
random-access
Sometimes we need a pseudo-random number for kick-starting a random number generator.
generate-secure-seed
, generate-seed
And we may need to count groups of items in a larger group.
count-groups
Assorted utility functions used across Uncomplicate projects. For converting keyword options to integers, use [[mask]], [[unmask]], and [[unmask1]]. For converting C-style error as returned numbers to exceptions, use [[with-check]] and [[dragan-says-ex]]. A few assorted functions: [[enc-keyword]], [[cond-into]]. When working with `ByteBuffers`, enlist the following functions for help: [[direct-buffer]], [[slice-buffer]], [[capacity]], [[put-float!]] [[get-float]] [[put-double!]] [[get-double]] [[put-long!]] [[get-long]] [[put-int!]] [[get-int]] [[put-short!]] [[get-short]] [[put-byte!]] [[get-byte]] When mapping files to direct buffers, these functions can help. [[mapped-buffer]], [[reverse-short-bytes!]], [[reverse-long-bytes!]] The following functions are useful when working with Java file channels. [[dev-open-option]], [[channel]] [[random-access]] Sometimes we need a pseudo-random number for kick-starting a random number generator. [[generate-secure-seed]], [[generate-seed]] And we may need to count groups of items in a larger group. [[count-groups]]
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close