Trait otter_api_tests::shapelib::PieceTrait[][src]

pub trait PieceTrait: 'static + OutlineTrait + Send + Debug + Serialize + Deserialize {
    pub fn nfaces(&self) -> u8;
pub fn svg_piece(
        &self,
        f: &mut Html,
        gpc: &GPiece,
        gs: &GameState,
        id: VisiblePieceId
    ) -> Result<(), InternalError>;
pub fn describe_html(
        &self,
        gpc: &GPiece,
        _goccults: &GameOccults
    ) -> Result<Html, InternalError>;
pub fn itemname(&self) -> &str; pub fn add_ui_operations(
        &self,
        ShowUnocculted,
        _upd: &mut Vec<UoDescription, Global>,
        _gs: &GameState,
        _gpc: &GPiece
    ) -> Result<(), InternalError> { ... }
pub fn ui_operation(
        &self,
        ShowUnocculted,
        _a: ApiPieceOpArgs<'_>,
        _opname: &str,
        _wrc: WhatResponseToClientOp
    ) -> Result<(PieceUpdate, Option<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>>), ApiPieceOpError> { ... }
pub fn held_change_hook(
        &self,
        _ig: &InstanceRef,
        _gpieces: &mut GPieces,
        _piece: PieceId,
        _was_held: Option<PlayerId>
    ) -> Result<Option<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>>, InternalError> { ... }
pub fn loaded_hook(
        &self,
        _piece: PieceId,
        _gs: &mut GameState,
        _ig: &InstanceRef
    ) -> Result<(), InternalError> { ... }
pub fn delete_hook(
        &self,
        _p: &GPiece,
        _gs: &mut GameState
    ) -> ExecuteGameChangeUpdates { ... }
pub fn sortkey(&self) -> Option<&str> { ... }
pub fn occultation_notify_hook(
        &self,
        _piece: PieceId
    ) -> Option<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>> { ... }
pub fn abs_bbox(&self, p: &GPiece) -> Result<RectC<i32>, InternalError> { ... } }

Required methods

pub fn nfaces(&self) -> u8[src]

by convention, occult face is nfaces-1

pub fn svg_piece(
    &self,
    f: &mut Html,
    gpc: &GPiece,
    gs: &GameState,
    id: VisiblePieceId
) -> Result<(), InternalError>
[src]

pub fn describe_html(
    &self,
    gpc: &GPiece,
    _goccults: &GameOccults
) -> Result<Html, InternalError>
[src]

pub fn itemname(&self) -> &str[src]

Loading content...

Provided methods

pub fn add_ui_operations(
    &self,
    ShowUnocculted,
    _upd: &mut Vec<UoDescription, Global>,
    _gs: &GameState,
    _gpc: &GPiece
) -> Result<(), InternalError>
[src]

pub fn ui_operation(
    &self,
    ShowUnocculted,
    _a: ApiPieceOpArgs<'_>,
    _opname: &str,
    _wrc: WhatResponseToClientOp
) -> Result<(PieceUpdate, Option<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>>), ApiPieceOpError>
[src]

pub fn held_change_hook(
    &self,
    _ig: &InstanceRef,
    _gpieces: &mut GPieces,
    _piece: PieceId,
    _was_held: Option<PlayerId>
) -> Result<Option<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>>, InternalError>
[src]

Piece is responsible for dealing with the possibility that they may be occulted!

pub fn loaded_hook(
    &self,
    _piece: PieceId,
    _gs: &mut GameState,
    _ig: &InstanceRef
) -> Result<(), InternalError>
[src]

pub fn delete_hook(
    &self,
    _p: &GPiece,
    _gs: &mut GameState
) -> ExecuteGameChangeUpdates
[src]

Not called if the whole game is destroyed. You can use Drop of course but it’s not usually much use since you don’t have a reference to the game or anything.

pub fn sortkey(&self) -> Option<&str>[src]

pub fn occultation_notify_hook(
    &self,
    _piece: PieceId
) -> Option<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>>
[src]

pub fn abs_bbox(&self, p: &GPiece) -> Result<RectC<i32>, InternalError>[src]

Loading content...

Trait Implementations

impl<'typetag> Serialize for dyn PieceTrait + 'typetag + Sync[src]

impl<'typetag> Serialize for dyn PieceTrait + 'typetag + Sync + Send[src]

impl<'typetag> Serialize for dyn PieceTrait + 'typetag + Send[src]

impl<'typetag> Serialize for dyn PieceTrait + 'typetag[src]

Implementors

impl PieceTrait for GenericSimpleShape<Html, Outline>[src]

impl PieceTrait for Item[src]

Loading content...