Merge pull request #1015 from davidhewitt/class-introduction

Add introduction to class.md
This commit is contained in:
Yuji Kanagawa 2020-07-02 12:01:23 +09:00 committed by GitHub
commit cccb942b65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -1,5 +1,22 @@
# Python Classes
PyO3 exposes a group of attributes powered by Rust's proc macro system for defining Python classes as Rust structs. This chapter will discuss the functionality and configuration they offer.
For ease of discovery, below is a list of all custom attributes with links to the relevant section of this chapter:
- [`#[pyclass]`](#defining-a-new-class)
- [`#[pyo3(get, set)]`](#object-properties-using-pyo3get-set)
- [`#[pymethods]`](#instance-methods)
- [`#[new]`](#constructor)
- [`#[getter]`](#object-properties-using-getter-and-setter)
- [`#[setter]`](#object-properties-using-getter-and-setter)
- [`#[staticmethod]`](#static-methods)
- [`#[classmethod]`](#class-methods)
- [`#[call]`](#callable-objects)
- [`#[classattr]`](#class-attributes)
- [`#[args]`](#method-arguments)
- [`#[pyproto]`](#class-customizations)
## Defining a new class
To define a custom Python class, a Rust struct needs to be annotated with the