ManagedResource

org.llm4s.resource.ManagedResource
See theManagedResource companion object
trait ManagedResource[R]

Managed resource abstraction for safe resource handling. Builds on the existing bracket functionality in types.package.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def acquire(): Result[R]

Acquire the resource

Acquire the resource

Attributes

def release(resource: R): Result[Unit]

Release the resource safely

Release the resource safely

Attributes

Concrete methods

def flatMap[S](f: R => ManagedResource[S]): ManagedResource[S]
Implicitly added by ManagedResourceOps

FlatMap for resource composition

FlatMap for resource composition

Attributes

def map[S](f: R => S): ManagedResource[S]
Implicitly added by ManagedResourceOps

Map over the resource

Map over the resource

Attributes

def use[A](f: R => Result[A]): Result[A]

Use the resource with automatic cleanup

Use the resource with automatic cleanup

Attributes