Struct Shared

Source
pub struct Shared<T>(pub Rc<RefCell<T>>);

Tuple Fields§

§0: Rc<RefCell<T>>

Implementations§

Source§

impl<T> Shared<T>

Source

pub fn new(t: T) -> Shared<T>

Source

pub fn borrow(&self) -> Ref<'_, T>

Source

pub fn borrow_mut(&self) -> RefMut<'_, T>

Source

pub fn as_ptr(&self) -> *mut T

Trait Implementations§

Source§

impl<T> Clone for Shared<T>

Source§

fn clone(&self) -> Shared<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Shared<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, T> Deref for Shared<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<Args, F: Differentiable<Args>> Differentiable<Args> for Shared<F>

Source§

type Jacobian = <F as Differentiable<Args>>::Jacobian

Source§

fn grad(&self, args: Args) -> Self::Jacobian

Source§

fn grad_log(&self, args: Args) -> Self::Jacobian

Source§

impl<T: Display> Display for Shared<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Args, F: Enumerable<Args>> Enumerable<Args> for Shared<F>

Source§

fn len(&self, args: Args) -> usize

Source§

fn evaluate_index( &self, args: Args, index: usize, ) -> <Self::Output as Index<usize>>::Output

Source§

fn find_min( &self, args: Args, ) -> (usize, <Self::Output as Index<usize>>::Output)
where Self::Output: IntoIterator<Item = <Self::Output as Index<usize>>::Output>, <Self::Output as Index<usize>>::Output: PartialOrd + Sized,

Source§

fn find_max( &self, args: Args, ) -> (usize, <Self::Output as Index<usize>>::Output)
where Self::Output: IntoIterator<Item = <Self::Output as Index<usize>>::Output>, <Self::Output as Index<usize>>::Output: PartialOrd + Sized,

Source§

fn expected_value<I: IntoIterator<Item = f64>>(&self, args: Args, ps: I) -> f64
where Self::Output: IntoIterator<Item = <Self::Output as Index<usize>>::Output>, <Self::Output as Index<usize>>::Output: Mul<f64, Output = f64>,

Source§

impl<Args, F: Function<Args>> Function<Args> for Shared<F>

Source§

type Output = <F as Function<Args>>::Output

Source§

fn evaluate(&self, args: Args) -> Self::Output

Source§

impl<M: Message, T: Handler<M>> Handler<M> for Shared<T>

Source§

type Response = <T as Handler<M>>::Response

Source§

type Error = <T as Handler<M>>::Error

Source§

fn handle(&mut self, msg: M) -> Result<Self::Response, Self::Error>

Source§

fn handle_unchecked(&mut self, msg: M) -> Self::Response

Source§

impl<F: Parameterised> Parameterised for Shared<F>

Source§

fn weights(&self) -> Weights

Return an owned copy of the weights.
Source§

fn weights_view(&self) -> WeightsView<'_>

Return a read-only view of the weights.
Source§

fn weights_view_mut(&mut self) -> WeightsViewMut<'_>

Return a mutable view of the weights.
Source§

fn weights_dim(&self) -> (usize, usize)

Return the dimensions of the weight matrix.
Source§

fn n_weights(&self) -> usize

Source§

impl<S, T: Policy<S>> Policy<S> for Shared<T>

Source§

type Action = <T as Policy<S>>::Action

Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R, state: S) -> Self::Action

Sample the (possibly stochastic) policy distribution for a given state.
Source§

fn mode(&self, state: S) -> Self::Action

Return the most probable action according to the policy distribution, if well-defined.

Auto Trait Implementations§

§

impl<T> Freeze for Shared<T>

§

impl<T> !RefUnwindSafe for Shared<T>

§

impl<T> !Send for Shared<T>

§

impl<T> !Sync for Shared<T>

§

impl<T> Unpin for Shared<T>

§

impl<T> !UnwindSafe for Shared<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<S, P> DifferentiablePolicy<S> for P
where P: Policy<S> + Differentiable<(S, <P as Policy<S>>::Action), Jacobian = ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, Jacobian = ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>> + for<'a> Differentiable<(S, &'a <P as Policy<S>>::Action)>,

Source§

impl<M> Message for M