View Source Bunch.Struct (Bunch v1.6.1)

A bunch of functions for easier manipulation on structs.

Summary

Functions

Wraps Bunch.Access.delete_in/2 to make it work with structs that do not implement Access behaviour.

Wraps Bunch.Access.get_and_update_in/3 to make it work with structs that do not implement Access behaviour.

Wraps Bunch.Access.get_in/2 to make it work with structs that do not implement Access behaviour.

Wraps Bunch.Access.pop_in/2 to make it work with structs that do not implement Access behaviour.

Wraps Bunch.Access.put_in/3 to make it work with structs that do not implement Access behaviour.

Wraps Bunch.Access.update_in/3 to make it work with structs that do not implement Access behaviour.

Functions

@spec delete_in(
  struct(),
  Access.key() | [Access.key()]
) :: struct()

Wraps Bunch.Access.delete_in/2 to make it work with structs that do not implement Access behaviour.

Link to this function

get_and_update_in(struct, keys, f)

View Source
@spec get_and_update_in(struct(), Access.key() | [Access.key()], (a -> {b, a})) ::
  {b, struct()}
when a: Access.value(), b: any()

Wraps Bunch.Access.get_and_update_in/3 to make it work with structs that do not implement Access behaviour.

@spec get_in(
  struct(),
  Access.key() | [Access.key()]
) :: Access.value()

Wraps Bunch.Access.get_in/2 to make it work with structs that do not implement Access behaviour.

@spec pop_in(
  struct(),
  Access.key() | [Access.key()]
) :: {Access.value(), struct()}

Wraps Bunch.Access.pop_in/2 to make it work with structs that do not implement Access behaviour.

@spec put_in(struct(), Access.key() | [Access.key()], Access.value()) ::
  Access.value()

Wraps Bunch.Access.put_in/3 to make it work with structs that do not implement Access behaviour.

Link to this function

update_in(struct, keys, f)

View Source
@spec update_in(
  struct(),
  Access.key() | [Access.key()],
  (Access.value() -> Access.value())
) :: struct()

Wraps Bunch.Access.update_in/3 to make it work with structs that do not implement Access behaviour.