MCPcopy Create free account
hub / github.com/TelegramMessenger/cocoon / get_double

Method get_double

runners/helpers/ValidateRequest.cpp:644–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

642 }
643
644 td::Result<double> get_double() {
645 switch (mode) {
646 case Mode::Form:
647 return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be a double");
648 case Mode::Slice: {
649 return td::to_double(field->value);
650 }
651 case Mode::Json: {
652 auto e = obj;
653 if (!e || !e->is_number()) {
654 return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be a double");
655 }
656 return e->get<double>();
657 }
658 default:
659 return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be a double");
660 }
661 }
662};
663
664struct Ctx {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected