weakref

package
v0.0.0-...-5f7e82d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2019 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package weakref -- reference an object while still allowing it to be GC'd Adapted/fixed code from: https://play.golang.org/p/f9HY6-z8Pp This is just an experiment for education purposes. DO NOT USE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WeakRef

type WeakRef struct {
	// contains filtered or unexported fields
}

WeakRef -- See https://research.swtch.com/interfaces

func NewWeakRef

func NewWeakRef(v interface{}) *WeakRef

NewWeakRef -- create a new WeakRef from target object/interface{}

func (*WeakRef) GetTarget

func (w *WeakRef) GetTarget() (v interface{})

GetTarget -- return a target object/interface{} from WeakRef

func (*WeakRef) IsAlive

func (w *WeakRef) IsAlive() bool

IsAlive -- check if the object referenced by the WeakRef has already been GC'd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL