% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/share.R
\name{fetch}
\alias{fetch}
\alias{fetch.shard_shared}
\alias{fetch.shard_deep_shared}
\alias{fetch.default}
\title{Fetch Data from a Shared Object}
\usage{
fetch(x, ...)

\method{fetch}{shard_shared}(x, ...)

\method{fetch}{shard_deep_shared}(x, ...)

\method{fetch}{default}(x, ...)
}
\arguments{
\item{x}{A \code{shard_shared} object.}

\item{...}{Ignored.}
}
\value{
The original R object that was shared.
}
\description{
Retrieves the R object from shared memory by deserializing it. This is the
primary way to access shared data in workers.
}
\details{
When called in the main process, this reads from the existing segment.
When called in a worker process, this opens the segment by path and
deserializes the data.

The \code{fetch()} function is the primary way to access shared data.
It can also be called as \code{materialize()} for compatibility.
}
\examples{
\donttest{
x <- 1:100
shared <- share(x)
recovered <- fetch(shared)
identical(x, recovered)
close(shared)
}
}
