MCPcopy Create free account
hub / github.com/hashintel/hash / try_kpc

Function try_kpc

libs/darwin-kperf/src/sampler/error.rs:154–156  ·  view source on GitHub ↗

Converts a KPC return code into a [`Result`], using `error` to construct the [`SamplerError`] variant for non-zero codes.

(code: c_int, error: fn(c_int) -> SamplerError)

Source from the content-addressed store, hash-verified

152/// Converts a KPC return code into a [`Result`], using `error` to construct
153/// the [`SamplerError`] variant for non-zero codes.
154pub(crate) fn try_kpc(code: c_int, error: fn(c_int) -> SamplerError) -> Result<(), SamplerError> {
155 if code == 0 { Ok(()) } else { Err(error(code)) }
156}

Callers 6

startMethod · 0.85
sampleMethod · 0.85
stopMethod · 0.85
releaseMethod · 0.85
ll_configureFunction · 0.85
ll_initFunction · 0.85

Calls 3

OkInterface · 0.85
ErrInterface · 0.85
errorFunction · 0.50

Tested by

no test coverage detected