module Bucket:Bucket-style datastucturesig..end
make ~size ~init_level
Create a new bucket. Fails if init_level is not within bounds zero;size.
level t
Get the current bucket level.
take t x
Take some exact amount out of the bucket and return `Taken. If there is not
enough left in the bucket, return `Unable.
take_at_most t x
Take some amount out of the bucket, possibly emptying it. The return value
is the amount that was actually taken out.
fill t x
Put some amount into the bucket, possibly overflowing. The return value
is the amount that was actually added to the bucket.
module type Contents =sig..end
make ~size ~init_level
Create a new bucket. Fails if init_level is not within bounds zero;size.
level t
Get the current bucket level.
take t x
Take some exact amount out of the bucket and return `Taken. If there is not
enough left in the bucket, return `Unable.
take_at_most t x
Take some amount out of the bucket, possibly emptying it. The return value
is the amount that was actually taken out.
fill t x
Put some amount into the bucket, possibly overflowing. The return value
is the amount that was actually added to the bucket.
module type S =sig..end
module Make: module Int:Make(Std_internal.Int)
module Int64:Make(Std_internal.Int64)
module Float:Make(Float)