From a74a39ead9bc99bd54b2dd998bda826b6def1ed4 Mon Sep 17 00:00:00 2001 From: Maksym Fedorov Date: Fri, 29 Sep 2023 12:31:46 +0200 Subject: [PATCH] Fix supervised/scoped code example --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 37db7813..8ddb06e5 100644 --- a/README.md +++ b/README.md @@ -290,15 +290,16 @@ supervised { Resources can also be used in a dedicated scope: ```scala -import ox.useScoped +import ox.useSupervised case class MyResource(c: Int) -def acquire: MyResource = - println("acquiring ...") - MyResource(5) +def acquire(c: Int): MyResource = + println(s"acquiring $c ...") + MyResource(c) + def release(resource: MyResource): Unit = - println(s"releasing ${resource.c}...") + println(s"releasing ${resource.c} ...") useSupervised(acquire(10))(release) { resource => println(s"Using $resource ...")