Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
store-cast.hh
Go to the documentation of this file.
1#pragma once
3
5
6namespace nix {
7
15template<typename T>
16T & require(Store & store)
17{
18 auto * castedStore = dynamic_cast<T *>(&store);
19 if (!castedStore)
20 throw UsageError("%s not supported by store '%s'", T::operationName, store.config.getHumanReadableURI());
21 return *castedStore;
22}
23
24} // namespace nix
Definition store-api.hh:397
Definition error.hh:311
T & require(Store &store)
Definition store-cast.hh:16