"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ensuringWith = void 0;
exports.ensuringWith_ = ensuringWith_;

var _primitives = /*#__PURE__*/require("@effect/core/stream/Channel/definition/primitives");

/**
 * Returns a new channel with an attached finalizer. The finalizer is
 * guaranteed to be executed so long as the channel begins execution (and
 * regardless of whether or not it completes).
 *
 * @tsplus fluent ets/Channel ensuringWith
 */
function ensuringWith_(channel, finalizer) {
  return new _primitives.Ensuring(channel, finalizer);
}
/**
 * Returns a new channel with an attached finalizer. The finalizer is
 * guaranteed to be executed so long as the channel begins execution (and
 * regardless of whether or not it completes).
 *
 * @tsplus static ets/Channel/Aspects ensuringWith
 */


const ensuringWith = finalizer => channel => ensuringWith_(channel, finalizer);

exports.ensuringWith = ensuringWith;
//# sourceMappingURL=ensuringWith.js.map