File Size v1.3.0 FileSize.Calculable protocol View Source
A protocol that defines calculations that are possible on file sizes.
Link to this section Summary
Link to this section Types
Link to this type
t()
View Source
t()
View Source
t() :: term()
t() :: term()
Link to this section Functions
Link to this function
add(size, other_size) View Source
Adds two file sizes.
Examples
iex> FileSize.add(FileSize.new(1, :kb), FileSize.new(2, :kb))
#FileSize<"3.0 kB">
iex> FileSize.add(FileSize.new(1, :b), FileSize.new(4, :bit))
#FileSize<"12 bit">
iex> FileSize.add(FileSize.new(4, :bit), FileSize.new(1, :b))
#FileSize<"12 bit">
iex> FileSize.add(FileSize.new(4, :mb), FileSize.new(200, :kb))
#FileSize<"4.2 MB">
Link to this function
subtract(size, other_size) View Source
Subtracts two file sizes.
Examples
iex> FileSize.subtract(FileSize.new(3, :kb), FileSize.new(1, :kb))
#FileSize<"2.0 kB">
iex> FileSize.subtract(FileSize.new(1, :b), FileSize.new(4, :bit))
#FileSize<"4 bit">