# Packet

# Packet

Constructs for working with packets.

## Summary

| ### Functions ||
|---|---|
| `https://docs.cloud.google.com/vision-ai/docs/reference/cpp/group/packet#group__packet_1ga3e7200aee29a04eccaff5c25f4c172c5(Packet p)` | `absl::StatusOr< T >` FromPacket attempts to unmarshal a `Packet` into a desired C++ Type. |
| `https://docs.cloud.google.com/vision-ai/docs/reference/cpp/group/packet#group__packet_1gafbafc39eabf5f90258343404f82502c8(T && t)` | `absl::StatusOr< Packet >` ToPacket marshals an object of C++ type `T` into a `Packet`. |

## Functions

### FromPacket

```c++
absl::StatusOr< T > FromPacket(
  Packet p
)
```
FromPacket attempts to unmarshal a `Packet` into a desired C++ Type.

An error code will be returned if `p` cannot be extracted as the requested C++ type.

### ToPacket

```c++
absl::StatusOr< Packet > ToPacket(
  T && t
)
```
ToPacket marshals an object of C++ type `T` into a `Packet`.

The set of possible C++ types that can be marshalled are listed in visionai/streams/packet/packet_codecs/codec_selector.h