[ox] Add Result<T> read{OC,MC,Claw}<T>(...)

This commit is contained in:
2021-04-21 00:06:24 -05:00
parent 4540b410dc
commit 58dbda48c4
4 changed files with 65 additions and 31 deletions

View File

@@ -58,4 +58,16 @@ Error readClaw(const char *buff, std::size_t buffLen, T *val) {
return OxError(1);
}
template<typename T>
Result<T> readClaw(const char *buff, std::size_t buffLen) {
T val;
oxReturnError(readClaw(buff, buffLen, &val));
return ox::move(val);
}
template<typename T>
Result<T> readClaw(const Vector<char> &buff) {
return readClaw<T>(buff.data(), buff.size());
}
}